Class: ActionDispatch::Routing::Mapper

Inherits:
Object
  • Object
show all
Defined in:
lib/cropper/routing.rb

Instance Method Summary collapse

Instance Method Details

#cropper_for(*res) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/cropper/routing.rb', line 4

def cropper_for(*res)
  options = res.extract_options!
  res.map!(&:to_sym)

  # options[:path] ||= "cropper"
  # options[:as] ||= :cropper
  # options[:path] = "#{options[:path]}/" unless options[:path].last == '/'
  # mount Cropper::Engine => options[:path], :as => options[:as]

  Rails.application.routes.draw do
    resources :uploads, :module => :cropper
    res.each do |resource|
      resources resource do
        resources :uploads, :module => :cropper
      end
    end
  end
end