Module: SchemaPlus::ActiveRecord::Attribute

Defined in:
lib/schema_plus/active_record/attribute.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
# File 'lib/schema_plus/active_record/attribute.rb', line 4

def self.included(base)
  base.alias_method_chain :original_value, :schema_plus
end

Instance Method Details

#original_value_with_schema_plusObject



8
9
10
11
12
13
14
# File 'lib/schema_plus/active_record/attribute.rb', line 8

def original_value_with_schema_plus
  # prevent attempts to cast DB_DEFAULT to the attributes type.
  # We want to keep it as DB_DEFAULT so that we can handle it when
  # generating the sql.
  return DB_DEFAULT if value_before_type_cast.equal? DB_DEFAULT
  original_value_without_schema_plus
end