Class: Shoulda::Matchers::ActiveRecord::HaveDbColumnMatcher::DecoratedColumn

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/shoulda/matchers/active_record/have_db_column_matcher.rb

Instance Method Summary collapse

Constructor Details

#initialize(model, column) ⇒ DecoratedColumn

Returns a new instance of DecoratedColumn.



346
347
348
349
# File 'lib/shoulda/matchers/active_record/have_db_column_matcher.rb', line 346

def initialize(model, column)
  @model = model
  super(column)
end

Instance Method Details

#primary?Boolean

Returns:

  • (Boolean)


355
356
357
# File 'lib/shoulda/matchers/active_record/have_db_column_matcher.rb', line 355

def primary?
  model.primary_key == name
end

#type_cast_defaultObject



351
352
353
# File 'lib/shoulda/matchers/active_record/have_db_column_matcher.rb', line 351

def type_cast_default
  model.column_defaults[name]
end