Class: Gutentag::TagValidations
- Inherits:
-
Object
- Object
- Gutentag::TagValidations
- Defined in:
- lib/gutentag/tag_validations.rb
Constant Summary collapse
- DEFAULTS =
{ :presence => true, :uniqueness => {:case_sensitive => false} }.freeze
- DATABASE_ERROR_CLASSES =
lambda { classes = [] if ActiveRecord::VERSION::STRING.to_f > 4.0 classes << ActiveRecord::NoDatabaseError end classes << ActiveRecord::ConnectionNotEstablished classes << Mysql2::Error if defined?(::Mysql2) classes << PG::ConnectionBad if defined?(::PG) classes }.call.freeze
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(klass) ⇒ TagValidations
constructor
A new instance of TagValidations.
Constructor Details
#initialize(klass) ⇒ TagValidations
Returns a new instance of TagValidations.
26 27 28 |
# File 'lib/gutentag/tag_validations.rb', line 26 def initialize(klass) @klass = klass end |
Class Method Details
.call(klass) ⇒ Object
22 23 24 |
# File 'lib/gutentag/tag_validations.rb', line 22 def self.call(klass) new(klass).call end |
Instance Method Details
#call ⇒ Object
30 31 32 |
# File 'lib/gutentag/tag_validations.rb', line 30 def call klass.validates :name, .dup end |