Exception: FlexColumns::Errors::ConflictingJsonStorageNameError

Inherits:
FieldError
  • Object
show all
Defined in:
lib/flex_columns/errors.rb

Overview

Raised when you try to define a field with the same JSON storage name, but a different field name, as a previously-defined field.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model_class, column_name, new_field_name, existing_field_name, json_storage_name) ⇒ ConflictingJsonStorageNameError

Returns a new instance of ConflictingJsonStorageNameError.



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/flex_columns/errors.rb', line 37

def initialize(model_class, column_name, new_field_name, existing_field_name, json_storage_name)
  @model_class = model_class
  @column_name = column_name
  @new_field_name = new_field_name
  @existing_field_name = existing_field_name
  @json_storage_name = json_storage_name

  super(%{On class #{model_class.name}, flex column #{column_name.inspect}, you're trying to define a field,
#{new_field_name.inspect}, that has a JSON storage name of #{json_storage_name.inspect},
but there's already another field, #{existing_field_name.inspect}, that uses that same JSON storage name.

These fields would conflict in the JSON store, and thus this is not allowed.})
end

Instance Attribute Details

#column_nameObject (readonly)

Returns the value of attribute column_name.



35
36
37
# File 'lib/flex_columns/errors.rb', line 35

def column_name
  @column_name
end

#existing_field_nameObject (readonly)

Returns the value of attribute existing_field_name.



35
36
37
# File 'lib/flex_columns/errors.rb', line 35

def existing_field_name
  @existing_field_name
end

#json_storage_nameObject (readonly)

Returns the value of attribute json_storage_name.



35
36
37
# File 'lib/flex_columns/errors.rb', line 35

def json_storage_name
  @json_storage_name
end

#model_classObject (readonly)

Returns the value of attribute model_class.



35
36
37
# File 'lib/flex_columns/errors.rb', line 35

def model_class
  @model_class
end

#new_field_nameObject (readonly)

Returns the value of attribute new_field_name.



35
36
37
# File 'lib/flex_columns/errors.rb', line 35

def new_field_name
  @new_field_name
end