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, :finder)

        self.resource_class = options[:resource_class] if options.key?(:resource_class)
        self.resource_class = options[: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)

        if options.key?(:resource_class) or options.key?(:class_name)
          config[:request_name] = begin
            request_name = self.resource_class
            request_name = request_name.model_name.param_key if request_name.respond_to?(:model_name)
            request_name.to_s.underscore.gsub('/', '_')
          end
          options.delete(:resource_class) and options.delete(:class_name)
        end

        options.each do |key, value|
          config[key] = value.to_sym
        end

        create_resources_url_helpers!
      end
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, :finder)

        self.resource_class = options[:resource_class] if options.key?(:resource_class)
        self.resource_class = options[: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)

        if options.key?(:resource_class) or options.key?(:class_name)
          config[:request_name] = begin
            request_name = self.resource_class
            request_name = request_name.model_name.param_key if request_name.respond_to?(:model_name)
            request_name.to_s.underscore.gsub('/', '_')
          end
          options.delete(:resource_class) and options.delete(:class_name)
        end

        options.each do |key, value|
          config[key] = value.to_sym
        end

        create_resources_url_helpers!
      end
Used to overwrite the default assumptions InheritedResources do. Whenever
 this method is called, it should be on the top of your controller, since
 almost other methods depends on the values given to <<tt>>defaults</tt>.

 == Options

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

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

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

 * <tt>:route_collection_name</tt> - The name of the collection route. Defaults to :collection_name.

 * <tt>:route_instance_name</tt> - The name of the singular route. Defaults to :instance_name.

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

 * <tt>:singleton</tt> - Tells if this controller is singleton or not.

 * <tt>:finder</tt> - Specifies which method should be called to instantiate the resource.

     defaults :finder => :find_by_slug