Class: Restful::Configuration::Resource

Inherits:
Configurator show all
Defined in:
lib/restful/configuration.rb

Overview

Configuration object for one resource.

Options

The following options may be set for each resource configured on a web service:

  • :name_method => method to call on an instance to produce a human meaningful reference for the instance. Defaults to :name.

  • :serialization => options to be passed to a Restful::Configuration::ARSerialization to configure serialization of the ActiveRecord instance itself.

  • :url_for => if the named_route helper method cannot be guessed from normal Rails restful syntax, it may be overriden here.

  • :associations => you may include href references to the instance’s associations. This can be a single association, a simple array of assocations, or a hash of association href keys to assocation names. If this is set as a hash, then the key is the name of the href (without ‘_href’), and the value is the model association name. If value is nil, then key is assumed to be both.

  • :shallow => if you are serializing an association, by default member includes and association references are stripped. Set this to false to traverse deeply.

  • :no_inherited_options => normally a subclass inherits and merges into its base class settings. Setting this to true prevents this so that only the options specifically set for the class will be used. Default false.

Instance Method Summary collapse

Methods included from Configurable

#==, #deep_clone, #deeper_merge!, #explicitly_set?, #find_option, #hash, included, #initialize, #option_names, #reset, #set, #to_hash

Instance Method Details

#serialization(&block) ⇒ Object



381
382
383
384
385
386
# File 'lib/restful/configuration.rb', line 381

def serialization(&block)
  if block_given?
    yield(serialization_without_block)
  end        
  return serialization_without_block
end

#serialization_without_blockObject



380
# File 'lib/restful/configuration.rb', line 380

alias_method :serialization_without_block, :serialization