class ActionDispatch::Routing::Mapper::Resources::Resource

:nodoc:

def actions

def actions
  if @except
    available_actions - Array(@except).map(&:to_sym)
  else
    available_actions
  end
end

def available_actions

def available_actions
  if @only
    Array(@only).map(&:to_sym)
  else
    default_actions
  end
end

def collection_name

singular form are the same.
Checks for uncountable plurals, and appends "_index" if the plural and
def collection_name
  singular == plural ? "#{plural}_index" : plural
end

def default_actions(api_only)

def default_actions(api_only)
  if api_only
    [:index, :create, :show, :update, :destroy]
  else
    [:index, :create, :new, :show, :update, :destroy, :edit]
  end
end

def default_actions

def default_actions
  self.class.default_actions(@api_only)
end

def initialize(entities, api_only, shallow, options = {})

def initialize(entities, api_only, shallow, 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(options, valid_actions).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       = options.delete :only
  @except     = options.delete :except
end

def invalid_only_except_options(options, valid_actions)

def invalid_only_except_options(options, valid_actions)
  options.values_at(:only, :except).flatten.compact.uniq.map(&:to_sym) - valid_actions
end

def member_scope

def member_scope
  "#{path}/:#{param}"
end

def name

def name
  @as || @name
end

def nested_param

def nested_param
  :"#{singular}_#{param}"
end

def nested_scope

def nested_scope
  "#{path}/:#{nested_param}"
end

def new_scope(new_path)

def new_scope(new_path)
  "#{path}/#{new_path}"
end

def plural

def plural
  @plural ||= name.to_s
end

def resource_scope

def resource_scope
  controller
end

def shallow?

def shallow?
  @shallow
end

def singleton?; false; end

def singleton?; false; end

def singular

def singular
  @singular ||= name.to_s.singularize
end