• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

problem understanding routes

 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I am still fairly new to ruby and rails, and so may not have the correct vocabulary to even ask this question.
I have a form which posts to a save method in an action, this action path is very easy to understand, go to tasks_controller and go to save method there.


What is confusing me is this route at the very end of the save method in tasks_controller.rb.


What confuses me here is that there is no method name, just the task controller name. This redirect ends up calling the method "show" in the same controller. My question is why? How does it know to call the show method when it just mentions the controller name ?

Thanks for any help!
Kim
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
_path and _url helper methods are very smart.

In customer_project_task_path, "task" is singular, so it will default to the path for the :show action.

Here's a good cheatsheet for the conventions:
http://topfunky.com/clients/peepcode/REST-cheatsheet.pdf
 
Kim Kantola
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Marc, this is EXACTLY the kind of information I needed!! Can't thank you enough.
Some times when you are new to something, its hard to even know what you are looking for. I have spent hours on different sites and in books but was having no luck. It was driving me crazy not understanding why the path was working that way.

Thank you again so much!
Kim
reply
    Bookmark Topic Watch Topic
  • New Topic