Class: ActionDispatch::Routing::Mapper

Inherits:
Object
  • Object
show all
Defined in:
lib/dobro/routes.rb

Instance Method Summary collapse

Instance Method Details

#dobro_for(*resources) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/dobro/routes.rb', line 2

def dobro_for(*resources)
  options = resources.extract_options!
  outer_module, @scope[:module] = @scope[:module], nil

  resources.each do |res|

    Dobro.resources[res] = Dobro::Resource.new res, :namespace => @scope[:as]

    self.resources res, dobro_options_for(res).merge(options) do
      member { get :delete }
      yield if block_given?
    end
  end

  @scope[:module] = outer_module
end