Class: Mv::Core::Validation::Uniqueness
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/mv/core/validation/uniqueness.rb
Instance Attribute Summary collapse
-
#index_name ⇒ Object
readonly
Returns the value of attribute index_name.
Attributes inherited from Base
#allow_blank, #allow_nil, #as, #column_name, #create_trigger_name, #message, #on, #options, #table_name, #update_trigger_name
Instance Method Summary collapse
-
#initialize(table_name, column_name, opts) ⇒ Uniqueness
constructor
A new instance of Uniqueness.
- #to_a ⇒ Object
Methods inherited from Base
#<=>, #create?, #full_message, #update?
Constructor Details
#initialize(table_name, column_name, opts) ⇒ Uniqueness
Returns a new instance of Uniqueness.
13 14 15 16 17 18 19 |
# File 'lib/mv/core/validation/uniqueness.rb', line 13 def initialize(table_name, column_name, opts) opts = opts == true ? {} : opts super(table_name, column_name, opts) @index_name = opts.with_indifferent_access[:index_name] || default_index_name end |
Instance Attribute Details
#index_name ⇒ Object (readonly)
Returns the value of attribute index_name.
9 10 11 |
# File 'lib/mv/core/validation/uniqueness.rb', line 9 def index_name @index_name end |
Instance Method Details
#to_a ⇒ Object
21 22 23 |
# File 'lib/mv/core/validation/uniqueness.rb', line 21 def to_a super + [index_name.to_s] end |