Module: Tenacity::OrmExt::Sequel::InstanceMethods

Includes:
Helpers
Defined in:
lib/tenacity/orm_ext/sequel.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods included from Helpers

#_t_serialize_id_for_sql, #_t_serialize_ids, #id_class_for

Instance Method Details

#_t_reloadObject



145
146
147
148
# File 'lib/tenacity/orm_ext/sequel.rb', line 145

def _t_reload
  reload
  self
end

#_t_save_if_dirty(*args) ⇒ Object



150
151
152
# File 'lib/tenacity/orm_ext/sequel.rb', line 150

def _t_save_if_dirty(*args)
  !changed_columns.empty? ? save(*args) : true
end

#after_destroyObject



139
140
141
142
143
# File 'lib/tenacity/orm_ext/sequel.rb', line 139

def after_destroy
  associations = self.class._t_belongs_to_associations || []
  associations.each { |association| self._t_cleanup_belongs_to_association(association) }
  super
end

#after_saveObject



122
123
124
125
126
127
128
# File 'lib/tenacity/orm_ext/sequel.rb', line 122

def after_save
  _t_save_autosave_associations

  associations = self.class._t_has_many_associations || []
  associations.each { |association| self.class._t_save_associates(self, association) }
  super
end

#before_destroyObject



130
131
132
133
134
135
136
137
# File 'lib/tenacity/orm_ext/sequel.rb', line 130

def before_destroy
  associations = self.class._t_has_one_associations || []
  associations.each { |association| self._t_cleanup_has_one_association(association) }

  associations = self.class._t_has_many_associations || []
  associations.each { |association| self._t_cleanup_has_many_association(association) }
  super
end

#before_saveObject



117
118
119
120
# File 'lib/tenacity/orm_ext/sequel.rb', line 117

def before_save
  _t_verify_associates_exist
  super
end