Sha256: ce14bd7a8fbb6ba0968910a6b1dafc78546c7c5a80365d471c5745f3b01efe2b

Contents?: true

Size: 1.31 KB

Versions: 85

Compression:

Stored size: 1.31 KB

Contents

module ActionDispatch
  module Routing
    ACTIVE_SCAFFOLD_CORE_ROUTING = {
        :collection => {:show_search => :get, :render_field => :get},
        :member => {:row => :get, :update_column => :post, :render_field => :get}
    }
    ACTIVE_SCAFFOLD_ASSOCIATION_ROUTING = {
        :collection => {:edit_associated => :get, :new_existing => :get, :add_existing => :post},
        :member => {:edit_associated => :get, :add_association => :get, :destroy_existing => :delete}
    }
    class Mapper
      module Base
        def as_routes(options = {:association => true})
          collection do
            ActionDispatch::Routing::ACTIVE_SCAFFOLD_CORE_ROUTING[:collection].each {|name, type| send(type, name)}
          end
          member do
            ActionDispatch::Routing::ACTIVE_SCAFFOLD_CORE_ROUTING[:member].each {|name, type| send(type, name)}
          end
          as_association_routes if options[:association]
        end
        
        def as_association_routes
          collection do 
            ActionDispatch::Routing::ACTIVE_SCAFFOLD_ASSOCIATION_ROUTING[:collection].each {|name, type| send(type, name)}
          end
          member do
            ActionDispatch::Routing::ACTIVE_SCAFFOLD_ASSOCIATION_ROUTING[:member].each {|name, type| send(type, name)}
          end
        end
      end
    end
  end
end

Version data entries

85 entries across 70 versions & 4 rubygems

Version Path
active_scaffold_vho-4.0.0 lib/active_scaffold/extensions/routing_mapper.rb
active_scaffold_vho-3.2.14 lib/active_scaffold/extensions/routing_mapper.rb
active_scaffold_vho-3.2.13 lib/active_scaffold/extensions/routing_mapper.rb
active_scaffold_vho-3.2.12 lib/active_scaffold/extensions/routing_mapper.rb
active_scaffold_vho-3.2.11 lib/active_scaffold/extensions/routing_mapper.rb
active_scaffold_vho-3.2.10 lib/active_scaffold/extensions/routing_mapper.rb
active_scaffold_vho-3.2.9 lib/active_scaffold/extensions/routing_mapper.rb
active_scaffold_vho-3.2.8 lib/active_scaffold/extensions/routing_mapper.rb
active_scaffold_vho-3.2.7 lib/active_scaffold/extensions/routing_mapper.rb
active_scaffold_vho-3.2.6 lib/active_scaffold/extensions/routing_mapper.rb
active_scaffold_vho-3.2.5 lib/active_scaffold/extensions/routing_mapper.rb
active_scaffold_vho-3.2.4 lib/active_scaffold/extensions/routing_mapper.rb
active_scaffold_vho-3.2.3 lib/active_scaffold/extensions/routing_mapper.rb
active_scaffold_vho-3.2.2 lib/active_scaffold/extensions/routing_mapper.rb
active_scaffold_vho-3.2.1 lib/active_scaffold/extensions/routing_mapper.rb
active_scaffold_vho-3.2.0 lib/active_scaffold/extensions/routing_mapper.rb
active_scaffold_vho-3.0.31 lib/active_scaffold/extensions/routing_mapper.rb
active_scaffold_vho-3.1.8 lib/active_scaffold/extensions/routing_mapper.rb
active_scaffold_vho-3.0.30 lib/active_scaffold/extensions/routing_mapper.rb
active_scaffold_vho-3.0.29 lib/active_scaffold/extensions/routing_mapper.rb