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 trial
Isaac Kirstein
2,427 PointsCompile error in Build a Simple Rails app
Every step works until I tried the Delete link. I started getting the following error:
compile error /Users/yitzy/Projects/Treebook/app/views/statuses/index.html.erb:5: syntax error, unexpected ':' ...atus", new_status_path, class: "btn btn-success" );@output_b... ^ /Users/yitzy/Projects/Treebook/app/views/statuses/index.html.erb:7: syntax error, unexpected kDO_BLOCK, expecting kEND '); @statuses.each do |status| ^ /Users/yitzy/Projects/Treebook/app/views/statuses/index.html.erb:15: syntax error, unexpected ':', expecting ')' ...k_to "Delete", status, method: :delete, data: { confirm: "Ar... ^ /Users/yitzy/Projects/Treebook/app/views/statuses/index.html.erb:15: odd number list for Hash ...hod: :delete, data: { confirm: "Are you sure your want to de... ^ /Users/yitzy/Projects/Treebook/app/views/statuses/index.html.erb:15: syntax error, unexpected '}', expecting ')' ... want to delete this status?"} );@output_buffer.safe_concat(... ^ /Users//Projects/Treebook/app/views/statuses/index.html.erb:19: syntax error, unexpected kEND, expecting ')' '); end ;@output_buffer.to_s ^ /Users//Projects/Treebook/app/views/statuses/index.html.erb:20: syntax error, unexpected kENSURE, expecting ')'
/Users/***/Projects/Treebook/app/views/statuses/index.html.erb:22: syntax error, unexpected kEND, expecting ')'
ANY help greatly appreciated
5 Answers
Jason Loughry
5,680 PointsHey Isaac Kirstein, would you mind posting the code from this file: /Users/yitzy/Projects/Treebook/app/views/statuses/index.html.erb
That will help us target the issue a bit better. Looks like something's off with the syntax of that file, but hopefully we can help figure it out :)
Thanks very much, --Jason
Isaac Kirstein
2,427 Pointsi even downloaded the project file to make sure:
but here is my index.html.erb:
<div class="page-header"> <h1>All of the Statuses</h1> </div>
<% @statuses.each do |status| %> <div class="status"> <strong><%= status.name %></strong> <p><%= status.content %></p> <div class="meta"> <span class="admin"> | <%= link_to "Edit", edit_status_path(status) %> | <%= link_to "Delete", status, method: :delete, data: { confirm: "Are you sure your want to delete this status?"} %> </span> </div> </div> <% end %>
Jason Loughry
5,680 PointsHmmm... I'm in the process of learning Ruby on Rails as well, and I'm not really sure what's going on here.
Maybe Jim Hoskins or Jason Seifer can weigh in on the problem.
Jason Seifer
Treehouse Guest TeacherCan you paste the whole index.html.erb file? I think the issue may be somewhere else.
Isaac Kirstein
2,427 Points<div class="page-header"> <h1>All of the Statuses</h1> </div>
<% @statuses.each do |status| %> <div class="status"> <strong><%= status.name %></strong> <p><%= status.content %></p> <div class="meta"> <span class="admin"> <%= link_to "Edit", edit_status_path(status) %> | <%= link_to "Delete", status, method: :delete, data: { confirm: "Are you sure your want to delete this status?"} %> </span> </div> </div> <% end %>
Isaac Kirstein
2,427 PointsFigured it out!
The video Delete line did not work, but my original scaffold had this: <%= link_to "Delete", status, :method => :delete, :data => { :confirm => "Are you sure?"} %> which did work.
needed to uses: :method => instead of method: