Module: Cerializable::ActsAsCerializable::ClassMethods

Defined in:
lib/cerializable/acts_as_cerializable.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_cerializable(options = {}) ⇒ Object

acts_as_cerializable is used to declare that a model uses Cerializable for serialization.

Unless a module is specified via the serialize_with option, the base model’s cerializer will attempt to include a module based on the model’s name.

For example, calling Comment.acts_as_cerializable without a serialize_with option will cause Cerializable to look for a CommentSerializer.

Calling Comment.acts_as_cerializable serialize_with: MySerializer will cause Cerializable to look for a MySerializer instead.



78
79
80
# File 'lib/cerializable/acts_as_cerializable.rb', line 78

def acts_as_cerializable(options = {})
  Cerializable.setup(options.merge(base: self))
end