Class: Shoulda::Matchers::ActiveRecord::HaveDbColumnMatcher::DecoratedColumn
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Shoulda::Matchers::ActiveRecord::HaveDbColumnMatcher::DecoratedColumn
- Defined in:
- lib/shoulda/matchers/active_record/have_db_column_matcher.rb
Instance Method Summary collapse
-
#initialize(model, column) ⇒ DecoratedColumn
constructor
A new instance of DecoratedColumn.
- #primary? ⇒ Boolean
- #type_cast_default ⇒ Object
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
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_default ⇒ Object
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 |