0

Getting a weird syntax error that I wasn't getting before and now I'm not sure what I did that is causing it now.

Here's what my controller looks like:

class BlogController < ApplicationController

  def cs
    @compsci = Compsci.all
  end

  def personal
    @personalb = Personalb.all
  end

  def archivedBlogs
    @compsci = Compsci.all
    @personalb = Personalb.all
  end

  def viewblg (num = 0)
    @blog = Compsci.find_by (num)
  end
end

My view where I am calling a link_to function (this is what is showing on my error page):

<div class="panel">
    <ul>
    <% @compsci.each do |blog| %>
        <li><%= link_to "#{blog.title}", viewblog_path (blog.number) %></li>
    <% end %>
    </ul>
</div>

The exact error is this:

/Users/ebadly-mac/Desktop/apps/blog/app/views/blog/archivedBlogs.html.erb:12: syntax error, unexpected ( arg, expecting keyword_do or '{' or '(' ...#{blog.title}", viewblog_path (blog.number) );@output_buffer... ... ^ /Users/ebadly-mac/Desktop/apps/blog/app/views/blog/archivedBlogs.html.erb:20: syntax error, unexpected keyword_do_block, expecting keyword_end '.freeze; @personalb.each do |blog| ^ /Users/ebadly-mac/Desktop/apps/blog/app/views/blog/archivedBlogs.html.erb:21: syntax error, unexpected ( arg, expecting keyword_do or '{' or '(' ...#{blog.title}", viewblog_path (blog.number) );@output_buffer... ... ^ /Users/ebadly-mac/Desktop/apps/blog/app/views/blog/archivedBlogs.html.erb:29: syntax error, unexpected keyword_ensure, expecting end-of-input

1
  • Remove the space between viewblog_path and (blog.number). Commented Apr 19, 2015 at 22:56

1 Answer 1

1

You should not put spaces between method name and parenthesis.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.