Sha256: 559727d58c7a604c9ff9267c84f5e69fa03ef483c8316fd51c785f58e8100866

Contents?: true

Size: 385 Bytes

Versions: 4

Compression:

Stored size: 385 Bytes

Contents

# Changes an ActiveRecord class so its instances cannot be destroyed.
# origin: RM
module IndestructibleTrait
  as_trait do |*options|

    options = options[0] || {}

    before_destroy(options) do
      false
    end

    # Allow others to check whether this is an indestructible record.
    # This is not an ActiveRecord method.
    def destructible?
      false
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
serum-rails-0.2.1 spec/test_apps/rails-2-3/app/models/shared/indestructible_trait.rb
serum-rails-0.2.0 spec/test_apps/rails-2-3/app/models/shared/indestructible_trait.rb
serum-rails-0.1.1 spec/test_app/app/models/shared/indestructible_trait.rb
serum-rails-0.1.0 spec/test_app/app/models/shared/indestructible_trait.rb