Module: Offroad::ModelExtensions::GlobalDataInstanceMethods

Defined in:
lib/model_extensions.rb

Instance Method Summary collapse

Instance Method Details

#after_mirrored_data_destroyObject

:nodoc#



199
200
201
202
# File 'lib/model_extensions.rb', line 199

def after_mirrored_data_destroy
  Offroad::SendableRecordState::note_record_destroyed(self) if Offroad::app_online?
  return true
end

#after_mirrored_data_saveObject

:nodoc#



212
213
214
215
# File 'lib/model_extensions.rb', line 212

def after_mirrored_data_save
  Offroad::SendableRecordState::note_record_created_or_updated(self) if Offroad::app_online? && changed?
  return true
end

#before_mirrored_data_destroyObject

:nodoc#

Raises:

  • (ActiveRecord::ReadOnlyRecord)


193
194
195
196
# File 'lib/model_extensions.rb', line 193

def before_mirrored_data_destroy
  raise ActiveRecord::ReadOnlyRecord if locked_by_offroad?
  return true
end

#before_mirrored_data_saveObject

:nodoc#

Raises:

  • (ActiveRecord::ReadOnlyRecord)


205
206
207
208
209
# File 'lib/model_extensions.rb', line 205

def before_mirrored_data_save
  raise ActiveRecord::ReadOnlyRecord if locked_by_offroad?
  validate_changed_id_columns
  return true
end

#locked_by_offroad?Boolean

Methods below this point are only to be used internally by Offroad However, marking all of them private would make using them from elsewhere troublesome

Returns:

  • (Boolean)


188
189
190
# File 'lib/model_extensions.rb', line 188

def locked_by_offroad?
  Offroad::app_offline?
end