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.

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 :-)