Module: Ambry::ActiveModel

Defined in:
lib/ambry/active_model.rb

Overview

Extend this module if you want Active Model support. Active Model is an API provided by Rails to make any Ruby object behave like an Active Record model instance. You can read an older writeup about it here.

Defined Under Namespace

Modules: ClassMethods, InstanceMethods, Validations

Class Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/ambry/active_model.rb', line 9

def self.extended(base)
  base.instance_eval do
    extend  ClassMethods
    include InstanceMethods
    extend  ::ActiveModel::Naming
    extend  ::ActiveModel::Translation
    include ::ActiveModel::Validations
    include ::ActiveModel::Serializers::JSON
    include ::ActiveModel::Serializers::Xml
    extend  ::ActiveModel::Callbacks
    define_model_callbacks :save, :destroy
  end
end