module Cerializable::Model::ClassMethods

Public Instance Methods

acts_as_cerializable(options = {}) click to toggle source

`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.

# File lib/cerializable/model.rb, line 79
def acts_as_cerializable(options = {})
  message = "'acts_as_cerializable' is deprecated and will be \
  removed from Cerializable in v1.0.0. Use 'cerializable' instead."
  Kernel.warn message
  cerializable(options)
end
cerializable(options = {}) click to toggle source
# File lib/cerializable/model.rb, line 86
def cerializable(options = {})
  Cerializable.setup(options.merge(base: self))
end