Module: ActiveRecord::Block::ClassMethods
- Defined in:
- lib/active_record/block.rb
Instance Method Summary collapse
Instance Method Details
#load_cant_be_destroyed_callback ⇒ Object
24 25 26 |
# File 'lib/active_record/block.rb', line 24 def load_cant_be_destroyed_callback before_destroy :cant_be_destroyed, if: -> { !destroyable? } end |
#load_cant_be_updated_validate ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/active_record/block.rb', line 14 def load_cant_be_updated_validate validate do if persisted? && !updateable? attribute_names.each do |attr| errors.add(attr, :cant_be_updated) if send("#{attr}_changed?") end end end end |