Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails: Where does new_*something*_path variable get set up?

I created a scaffold for 'messages', and new_message_path and edit_message_path (for use in link_to's) are all set up, but now I've created app/views/messages/sent.html.erb, and I want to do something along the lines of <%= link_to 'Sent', sent_message_path %>, but I can't figure out how to do that. I get

undefined local variable or method `sent_message_path' for #<ActionView::Base:0x103117c50>
like image 200
RankWeis Avatar asked Nov 08 '10 20:11

RankWeis


1 Answers

Those methods are created automatically when routes are defined and in the case of RESTful routes, they follow a predictable convention.

Running 'rake routes' is a helpful way of seeing all of the routes being generated.

I recommend you read: http://guides.rubyonrails.org/routing.html

like image 135
Andy Ferra Avatar answered Oct 19 '22 11:10

Andy Ferra