Module: ActiveRemote::Persistence

Included in:
Base
Defined in:
lib/active_remote/persistence.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/active_remote/persistence.rb', line 5

def self.included(klass)
  klass.class_eval do
    extend ::ActiveRemote::Persistence::ClassMethods
    include ::ActiveRemote::Persistence::InstanceMethods
    include ::ActiveRemote::RPC

    # Allow users to create callbacks around a `save` call.
    #
    define_model_callbacks :save, :create, :update

    # Before a save occurs, ensure that we
    # clear out the errors list.
    #
    set_callback :save, :before do |remote|
      remote.errors.clear
    end
  end
end