Module: ActiveMocker::ActiveHash::ARApi::ClassMethods
Instance Method Summary
collapse
#find_by, #find_by!, #where
#destroy_all
Instance Method Details
#find_or_create_by(attributes) ⇒ Object
21
22
23
|
# File 'lib/active_hash/ar_api.rb', line 21
def find_or_create_by(attributes)
find_by(attributes) || create(attributes)
end
|
#find_or_initialize_by(attributes) ⇒ Object
25
26
27
|
# File 'lib/active_hash/ar_api.rb', line 25
def find_or_initialize_by(attributes)
find_by(attributes) || new(attributes)
end
|