Jason Cheung wrote: > How do you add an extra view? > I have "new, edit, show, etc.". > I'm having trouble using RESTful paths. > "new_viewname_path" works for linking to the "new" view but if I try > something like "myview_viewname_path" I get an error: "undefined local > variable or method `myview_viewname_path'" > Can anybody help?
the 'new' path and the 'edit' path are the only ones that actually have the name of the action in them. The rest are determined based on whether you refer to the singular or plural version of the resource (eg comments vs comment) and the type of the request. I found this cheatsheet very handy when i started using REST: http://topfunky.com/clients/peepcode/REST-cheatsheet.pdf The cheatsheet shows you how to add custom actions as well: basically you put the action in your controller and moddify the entry for that resource in your routes.rb. The views themselves are not the problem you were encountering: if the action is run successfully it will drop through to the view automatically. To put it another way, a path points to a particular action in a particular controller, rather than to a view. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

