Method: Her::Model::Relation#first_or_initialize
- Defined in:
- lib/castle-her/model/relation.rb
#first_or_initialize(attributes = {}) ⇒ Object
Fetch a resource and build it if it’s not found
154 155 156 |
# File 'lib/castle-her/model/relation.rb', line 154 def first_or_initialize(attributes = {}) fetch.first || build(attributes) end |