Exception: Sequel::MassAssignmentRestriction

Inherits:
Error
  • Object
show all
Defined in:
lib/sequel/model/exceptions.rb

Overview

Raised when a mass assignment method is called in strict mode with either a restricted column or a column without a setter method.

Instance Attribute Summary collapse

Attributes inherited from Error

#wrapped_exception

Class Method Summary collapse

Methods inherited from Error

#cause

Instance Attribute Details

#columnObject (readonly)

The column related to this exception, as a string.



34
35
36
# File 'lib/sequel/model/exceptions.rb', line 34

def column
  @column
end

#modelObject (readonly)

The Sequel::Model object related to this exception.



31
32
33
# File 'lib/sequel/model/exceptions.rb', line 31

def model
  @model
end

Class Method Details

.create(msg, model, column) ⇒ Object

Create an instance of this class with the model and column set.



37
38
39
40
41
42
# File 'lib/sequel/model/exceptions.rb', line 37

def self.create(msg, model, column)
  e = new("#{msg} for class #{model.class.inspect}")
  e.instance_variable_set(:@model, model)
  e.instance_variable_set(:@column, column)
  e
end