StartupInstituteChicago / Spring2014HerbPreintz

0 stars 0 forks source link

Delete functionality #4

Open hpreinitz opened 10 years ago

hpreinitz commented 10 years ago

I was following the Rails Guide section 5.14 for the delete functionality. http://guides.rubyonrails.org/getting_started.html#getting-up-and-running

For this line in the routes.rb file: delete /restaurants/:id(.:format)      restuarants#destroy

I get this error: /Users/hpDev/workspace/guide/config/routes.rb:7: syntax error, unexpected ':', expecting keyword_end delete /restaurants/:id(.:format) restuarants#destroy ^

I've tried these too with no success. delete /restaurants/:id(.:format)      'restuarants#destroy' delete  restuarants#destroy

I didn't find anything applicable on stack overflow.

I commented line out to move on.

sibrent commented 10 years ago

@chicagogrooves

sibrent commented 10 years ago

Try tagging the incoming instructor like I did in this request. Good work

Brent Williams @brentskeez Program Manager Chicago, Startup Institute

Apply for our Summer Classes http://apply.startupinstitute.com/ Forbeshttp://www.forbes.com/sites/karstenstrauss/2013/03/04/raising-an-army-of-startup-employees/ | ReadWritehttp://readwrite.com/2013/03/04/boston-startup-school-becomes-startup-institute-expands-to-new-york | GigaOMhttp://gigaom.com/2013/03/04/startups-101-new-program-provides-8-week-institute-for-wannabe-tech-employees/ | Xconomyhttp://www.xconomy.com/boston/2013/03/04/boston-startup-school-adds-ny-gets-new-name-startup-institute/

On Tue, Mar 25, 2014 at 6:26 PM, hpreinitz notifications@github.com wrote:

I was following the Rails Guide section 5.14 for the delete functionality. http://guides.rubyonrails.org/getting_started.html#getting-up-and-running

For this line in the routes.rb file: delete /restaurants/:id(.:format) restuarants#destroy

I get this error: /Users/hpDev/workspace/guide/config/routes.rb:7: syntax error, unexpected ':', expecting keyword_end delete /restaurants/:id(.:format) restuarants#destroy ^

I've tried these too with no success. delete /restaurants/:id(.:format) 'restuarants#destroy' delete restuarants#destroy

I didn't find anything applicable on stack overflow.

I commented line out to move on.

Reply to this email directly or view it on GitHubhttps://github.com/StartupInstituteChicago/Spring2014HerbPreintz/issues/4 .

hpreinitz commented 10 years ago

I'm not sure why the rails guide was saying to put this line in the routes.rb file: delete /restaurants/:id(.:format) restuarants#destroy

I put this line in the show.html.erb file, and I got the delete functionality to delete a record. <%= link_to 'Destroy', destroy_restaurant_path(@restaurant) %>

hpreinitz commented 10 years ago

My mistake, the previous line didn't work. I used this one.

<%= link_to 'Destroy', restaurant_path(@restaurant), method: :delete, data: { confirm: 'Are you sure?' } %>