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.



306
307
308
309
# File 'lib/shoulda/matchers/active_record/have_db_column_matcher.rb', line 306

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

Instance Method Details

#primary?Boolean

Returns:

  • (Boolean)


315
316
317
# File 'lib/shoulda/matchers/active_record/have_db_column_matcher.rb', line 315

def primary?
  model.primary_key == name
end

#type_cast_defaultObject



311
312
313
# File 'lib/shoulda/matchers/active_record/have_db_column_matcher.rb', line 311

def type_cast_default
  model.column_defaults[name]
end