module DataMapper::Is::ReadOnly

Public Instance Methods

is_read_only(options={}) click to toggle source

Makes a Model and all resources of the model, read-only.

@param [Hash] options

Additional options.

@option options [Boolean] :migrations

Specifies that migrations should be left enabled.

@option options [Boolean] :mutable

Specifies that the resource should remain mutable.

@example Disable both migrations and mutability

is :read_only

@example Do not disable migrations

is :read_only, :migrations => true

@example Do not disable mutability

is :read_only, :mutable => true
# File lib/dm-is-read_only/is/read_only.rb, line 27
def is_read_only(options={})
  unless options[:migrations]
    extend DataMapper::Is::ReadOnly::ClassMethods
  end

  unless options[:mutable]
    include DataMapper::Is::ReadOnly::InstanceMethods
  end
end