Sha256: a71c4699eb9db90f94defae3a43fdceec6eaf84d6fd0327c706dfdf49cc094bb
Contents?: true
Size: 1.65 KB
Versions: 8
Compression:
Stored size: 1.65 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 def as_nested_resources(*resources) options = resources.extract_options! resources.each do |resource| resources(resource, options.merge(:parent_scaffold => merge_module_scope(@scope[:module], parent_resource.plural), :association => resource)) { yield if block_given? } end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems