Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBrian Goldstein
19,419 PointsSyntax error after writing tests
Hi! after I finished the testing the whole app badge, I can't get treebook to open. I keep getting "syntax error, unexpected keyword_end" in StatusesController#index. here's the whole error message: SyntaxError in StatusesController#index
C:/Sites/Treebook/app/models/status.rb:10: syntax error, unexpected keyword_end Rails.root: C:/Sites/Treebook
app/controllers/statuses_controller.rb:1:in `<top (required)>' and here is the code referenced: app/views/status/index.html.erb
<div class="page-header">
<h1>Newsfeed</h1>
</div>
<%= link_to "Post a New Status", new_status_path, class:"btn btn-success" %>
<% @statuses.each do |status| %>
<div class="status">
<strong><%= status.user.full_name %></strong>
<p><%= status.content %></p>
</div>
<div class="meta">
<%= link_to time_ago_in_words(status.created_at) + " ago", status %>
<span class="admin">
| <%= link_to "Edit", edit_status_path(status)%></span> |
<%= link_to "Delete", status, method: :delete, data: { confirm: "Are you sure you want to delete this status?"}%> </span>
</div>
<% end %>
and app/models/status.rb class Status
< ActiveRecord::Base
attr_accessible :content, :user_id
belongs_to :user
validates :content, presence: true,
length: { minimum: 2}
validates :user_id, presence: true,
end
2 Answers
Tommy Morgan
Treehouse Guest TeacherHey Brian Goldstein -
The unexpected end
is the one on line 10 in status.rb. The reason it's unexpected is because you have a comma at the end of line 9 :)
Brian Goldstein
19,419 PointsWow. Wow. I'm almost ashamed of that. good eye! thanks.
Tommy Morgan
Treehouse Guest TeacherI can only point it out because I've done it more times than I can count :)