module InheritedResources::ClassMethods

def defaults(options)


* :singleton - Tells if this controller is singleton or not.

controllers. Default to :admin on Admin::ProjectsController.
* :route_prefix - The route prefix which is automically set in namespaced

* :route_instance_name - The name of the singular route. Defaults to :instance_name.

* :route_collection_name - The name of the collection route. Defaults to :collection_name.

:project in ProjectsController.
is set on all actions besides index action. Defaults to
* :instance_name - The name of the singular instance variable which

ProjectsController.
is set on the index action. Defaults to :projects in
* :collection_name - The name of the collection instance variable which

ProjectsController.
by the controller name. Defaults to Project in
* :resource_class - The resource class which by default is guessed

== Options

almost other methods depends on the values given to <>defaults.
this method is called, it should be on the top of your controller, since
Used to overwrite the default assumptions InheritedResources do. Whenever
def defaults(options)
  raise ArgumentError, 'Class method :defaults expects a hash of options.' unless options.is_a? Hash
  options.symbolize_keys!
  options.assert_valid_keys(:resource_class, :collection_name, :instance_name,
                            :class_name, :route_prefix, :route_collection_name,
                            :route_instance_name, :singleton)
  self.resource_class = options.delete(:resource_class)         if options.key?(:resource_class)
  self.resource_class = options.delete(:class_name).constantize if options.key?(:class_name)
  acts_as_singleton! if options.delete(:singleton)
  config = self.resources_configuration[:self]
  config[:route_prefix] = options.delete(:route_prefix) if options.key?(:route_prefix)
  options.each do |key, value|
    config[key] = value.to_sym
  end
  create_resources_url_helpers!
end