Module: Rhoconnect::Resource::HelperMethods

Defined in:
lib/rhoconnect/resource.rb

Instance Method Summary collapse

Instance Method Details

#install_callbacksObject



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/rhoconnect/resource.rb', line 107

def install_callbacks
  if is_datamapper?
    # test for dm-serializer
    if not is_defined?(DataMapper::Serialize)
      raise "Rhoconnect::Resource requires dm-serializer to work with DataMapper. Install with `gem install dm-serializer` and add to your application."
    end
    after :create, :rhoconnect_create
    after :destroy, :rhoconnect_destroy
    after :update, :rhoconnect_update
  elsif is_activerecord?
    after_create :rhoconnect_create
    after_destroy :rhoconnect_destroy
    after_update :rhoconnect_update
  else
    raise "Rhoconnect::Resource only supports ActiveRecord or DataMapper at this time."
  end
end