Sha256: 16859fa311abf78d483bc6351a5c1496cc6524c6d5c983ee45b9d3697a34ded3

Contents?: true

Size: 1.14 KB

Versions: 15

Compression:

Stored size: 1.14 KB

Contents

class Callbacker

  include DynaModel::Document
  
  string_attr :id
  boolean_attr :before_create_block_attr, default_value: false
  boolean_attr :before_create_method_attr, default_value: false
  boolean_attr :before_validation_on_create_method_attr, default_value: false
  validates_inclusion_of :before_validation_on_create_method_attr, in: [true]
  integer_attr :before_save_counter, default_value: 0
  integer_attr :before_update_counter, default_value: 0
  timestamps

  hash_key :id

  read_provision 2
  write_provision 8

  before_create :before_create_method
  before_create do
    self.before_create_block_attr = true
  end
  before_validation :before_validation_on_create_method, on: :create
  after_create :after_create_change_before_validation

  before_save do
    self.before_save_counter += 1
  end

  before_update do
    self.before_update_counter += 1
  end

  def before_create_method
    self.before_create_method_attr = true
  end

  def before_validation_on_create_method
    self.before_validation_on_create_method_attr = true
  end

  def after_create_change_before_validation
    self.before_validation_on_create_method_attr = false
  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
dyna_model-0.0.15 spec/app/models/callbacker.rb
dyna_model-0.0.14 spec/app/models/callbacker.rb
dyna_model-0.0.13 spec/app/models/callbacker.rb
dyna_model-0.0.12 spec/app/models/callbacker.rb
dyna_model-0.0.11 spec/app/models/callbacker.rb
dyna_model-0.0.10 spec/app/models/callbacker.rb
dyna_model-0.0.9 spec/app/models/callbacker.rb
dyna_model-0.0.8 spec/app/models/callbacker.rb
dyna_model-0.0.7 spec/app/models/callbacker.rb
dyna_model-0.0.6 spec/app/models/callbacker.rb
dyna_model-0.0.5 spec/app/models/callbacker.rb
dyna_model-0.0.4 spec/app/models/callbacker.rb
dyna_model-0.0.3 spec/app/models/callbacker.rb
dyna_model-0.0.2 spec/app/models/callbacker.rb
dyna_model-0.0.1 spec/app/models/callbacker.rb