method
new
new(entities, api_only, shallow, only: nil, except: nil, **options)public
No documentation available.
# File actionpack/lib/action_dispatch/routing/mapper.rb, line 1319
def initialize(entities, api_only, shallow, only: nil, except: nil, **options)
if options[:param].to_s.include?(":")
raise ArgumentError, ":param option can't contain colons"
end
valid_actions = self.class.default_actions(false) # ignore api_only for this validation
if (invalid_actions = invalid_only_except_options(valid_actions, only,, except)).presence)
error_prefix = "Route `resource#{"s" unless singleton?} :#{entities}`"
raise ArgumentError, "#{error_prefix} - :only and :except must include only #{valid_actions}, but also included #{invalid_actions}"
end
@name = entities.to_s
@path = (options[:path] || @name).to_s
@controller = (options[:controller] || @name).to_s
@as = options[:as]
@param = (options[:param] || :id).to_sym
@options = options
@shallow = shallow
@api_only = api_only
@only = only
@except = except
end