Could you tell me how to disable the .:format options in rails routes? I only need html...
相关问题
- Question marks after images and js/css files in ra
- Using :remote => true with hover event
- Eager-loading association count with Arel (Rails 3
- Is there a way to remove IDV Tags from an AIFF fil
- Rails how to handle error and exceptions in model
相关文章
- Right way to deploy Rails + Puma + Postgres app to
- AWS S3 in rails - how to set the s3_signature_vers
- 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
- Rspec controller error expecting <“index”> but
- Rspec controller error expecting <“index”> but
You can wrap you routes around a scope (Rails 4):
If you want pretty URLs and you don't like
:format => false
you might try this:Even using
with_options
, the:format => false
option is cumbersome, especially if you have a lot of routes.http://guides.rubyonrails.org/routing.html#request-based-constraints
This will constrain your routes to accept only html format:
However, it won't remove
(.:format)
part from yourrake routes
output.In 3.1.1 at least you can add ,
:format => false
to the end of the route.Found here: http://guides.rubyonrails.org/routing.html#request-based-constraints under section 3.11 Route Globbing
eg..
Which would allow params[:pages] to include a period.