Module: DynamicImage::Routing
- Defined in:
- lib/dynamic_image/routing.rb
Overview
DynamicImage Routing
Extends ActionDispatch::Routing::Mapper and provides a shortcut for defining routes for
DynamicImage::Controller.
Instance Method Summary collapse
-
#image_resources(resource_name, options = {}) ⇒ void
Declares an image resource, routing
showalong with theuncropped,originalanddownloadmember actions.
Instance Method Details
#image_resources(resource_name, options = {}) ⇒ void
This method returns an undefined value.
Declares an image resource, routing show along with the uncropped, original and download member actions.
The default path includes the digest and an optional size. Pass :path to change it if the resource collides
with a directory in public.
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/dynamic_image/routing.rb', line 23 def image_resources(resource_name, = {}) = { path: "#{resource_name}/:digest(/:size)", constraints: { size: /\d+x\d+/ }, only: %i[show] }.merge() resources resource_name, ** do get :uncropped, on: :member get :original, on: :member get :download, on: :member end end |