Class: Restful::Configuration::ARSerialization

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

Overview

Configuration for the ActiveRecord::Serialization::Serializer of one activerecord class.

Options

  • :only => an attribute name or an array of attribute names. Defines which attributes will be serialized.

  • :except => an attribute name or an array of attribute names. All attributes except these will be serialized. Inverse of :only. :only takes precedence.

  • :include => nested ARSerialization definitions for associations.

  • :methods => an method name or an array of method names to be included in the serialization.

See ActiveRecord::Serialization.to_json for more details

Instance Method Summary collapse

Methods included from Configurable

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

Instance Method Details

#includes(name, options = {}, &block) ⇒ Object

Allows you to configure an included ARSerialization instance. Expects a block.



409
410
411
# File 'lib/restful/configuration.rb', line 409

def includes(name, options = {}, &block)
  self.include[name] = ARSerialization.register(options, &block)
end