What are the paths that is automatically added by Rails? Let say you have a Question resource you automatically get questions_path, question_path etc. Where do I see what they resolve to and what I get?
相关问题
- Question marks after images and js/css files in ra
- Using :remote => true with hover event
- Eager-loading association count with Arel (Rails 3
- How to specify memcache server to Rack::Session::M
- Why am I getting a “C compiler cannot create execu
相关文章
- Ruby using wrong version of openssl
- Right way to deploy Rails + Puma + Postgres app to
- AWS S3 in rails - how to set the s3_signature_vers
- Difference between Thread#run and Thread#wakeup?
- how to call a active record named scope with a str
- How to add a JSON column in MySQL with Rails 5 Mig
- “No explicit conversion of Symbol into String” for
- form_for wrong number of arguments in rails 4
If you have the following in your routes file:
Then Rails provides the following restful routes for you:
You can also run rake:routes to see what is being generated.
Just use:
This will list all routes defined. The first column is relevant for you path helpers.
This section might be helpful http://guides.rubyonrails.org/routing.html#specifying-a-controller-to-use
If you want to create a helper for
show
action you can writewhere
@photo
is your model object. Or you can pass@photo
directly if it responds toid
method.You can also load
rails console
(in terminal) and test routes usingapp
like soapp.photo_path(1)
(it will show you the route for the photo withid
equals1
)