Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Brian Goldstein
Brian Goldstein
19,419 Points

Syntax 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">

 <%= 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 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>
 <% 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,

2 Answers

Tommy Morgan
Tommy Morgan
Treehouse Guest Teacher

Hey 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
Brian Goldstein
19,419 Points

Wow. Wow. I'm almost ashamed of that. good eye! thanks.

Tommy Morgan
Tommy Morgan
Treehouse Guest Teacher

I can only point it out because I've done it more times than I can count :)