Sha256: 3d0bd317d99be2bbd4a17338a71534248ced4bc7e8c19c3edb2d0e6eb213d981
Contents?: true
Size: 551 Bytes
Versions: 2
Compression:
Stored size: 551 Bytes
Contents
module ActiveMock module Creators def create(attributes = {}, &block) record = new record.save record.send(:set_properties, attributes) unless block_given? record.send(:set_properties_block, attributes, &block) if block_given? record end alias_method :create!, :create def find_or_create_by(attributes) find_by(attributes) || create(attributes) end def find_or_initialize_by(attributes) find_by(attributes) || new(attributes) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
active_mocker-1.4.2 | lib/active_mock/creators.rb |
active_mocker-1.4.1 | lib/active_mock/creators.rb |