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

Ruby

Richard McGrath
Richard McGrath
5,597 Points

Thought I let people know about a syntax change I found.

In order to stop this error:

Deleting todo items is successful
     Failure/Error: click_link 'List Items'

     SyntaxError:
       /Users/richm/Sites/odot/app/views/todo_items/index.html.erb:9: syntax error, unexpected ')', expecting =>
       ... { confirm: 'Are you sure?' } );@output_buffer.safe_append='
       ...                               ^
       /Users/richm/Sites/odot/app/views/todo_items/index.html.erb:11: syntax error, unexpected keyword_end, expecting ')'
       '.freeze;   end 
                      ^

I had to change the following in ...views/todo_items/index.html.erb

Code from Video:

  <%= link_to 'Delete', todo_list_todo_item_path(todo_item), method:
      :delete,  { confirm: 'Are you sure?' }  %>

Code that Passes (Syntax Change)

  <%= link_to 'Delete', todo_list_todo_item_path(todo_item), method:
      :delete, confirm: 'Are you sure?'  %>

1 Answer

I'm almost certain you're mistaken, actually, but I don't want to put a downer on your post at the same time! It's good to post these things, definitely, but I think there's probably something to learn from this:

The error says that there is an unexpected ')'. Now, I'm pretty experienced with Ruby, and I think the only way this error can occur here is if you actually DID have a bracket in your code, like this:

<%= link_to 'Delete', todo_list_todo_item_path(todo_item), method:
      :delete,  { confirm: 'Are you sure?' } ) %>

I think what's happened is that you corrected your code by taking away the bracket AND changing the Hash syntax an kind of forgot that you had removed that bracket, or didn't realise that bracket was there in the first place :-)