Sha256: 83b4f1d97546f68441d0e442ef1de24fd16a9f6614ced4d791f84775ecd931e2
Contents?: true
Size: 452 Bytes
Versions: 14
Compression:
Stored size: 452 Bytes
Contents
module KB module FindOrCreatable extend ActiveSupport::Concern included do include Queryable include Listable include Creatable end module ClassMethods def find_or_create_by(attributes, additional_attributes) all(attributes).first || new(create(additional_attributes.merge(attributes)), &:persist!) rescue Faraday::Error => e raise KB::Error.from_faraday(e) end end end end
Version data entries
14 entries across 14 versions & 1 rubygems