How Do I Add Custom Options To ActionController::Routing::Routes Map.resources?
there are several places in my routes.rb file where I say:
map.resources :foo, :only => [:show, :index]
and I would like to be able to say:
map.resources :foo, :readonly => true
..or something of the like. I know this may seem kind of pointless, since it only saves a couple of characters, but I'd like to know how to do it so that I can add other more complicated options in the future.
Not quite what you're looking for, but you could save some typing with Object#with_options:
map.with_options(:only => [:show, :index]) do |readonly| readonly.resources :foo readonly.resources :bar ... end
Otherwise, you're probably looking at monkey patching or subclassing
- → Trigger a click with jQuery using link_to of rails 4
- → Adding html data attribute to simple_forms input
- → How to remove parameters from the root URL if it does I18n
- → passing parameters to rails back end from an ajax call
- → Blocking ?page= in robots.txt
- → react js and rails Updating state on a component with active record relationship
- → State not passed into prop
- → Cannot read property 'modalIsOpen' of undefined
- → Objects not valid issue
- → How to map API params to model
- → Consuming webhooks shopify-api
- → How to add ScriptTag on shopify_api gem?