Sha256: 0d51c30fd04da0171339534f3a4a20ee31b11eb4c01a48f0cc605df1d549776b

Contents?: true

Size: 694 Bytes

Versions: 21

Compression:

Stored size: 694 Bytes

Contents

require_relative 'destroy_all'
require_relative 'update'
require_relative 'find_by'
require_relative 'init'
module ActiveMocker
  module ActiveHash

    module ARApi

      include ::ActiveHash::ARApi::Update
      include ::ActiveHash::ARApi::Init

      def self.included(base)
        base.extend(ClassMethods)
      end

      module ClassMethods
        include ::ActiveHash::ARApi::DestroyAll
        include ::ActiveHash::ARApi::FindBy

        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



  end

end



Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
active_mocker-1.2.3 lib/active_hash/ar_api.rb
active_mocker-1.2 lib/active_hash/ar_api.rb
active_mocker-1.2.pre.11 lib/active_hash/ar_api.rb
active_mocker-1.2.pre.10 lib/active_hash/ar_api.rb
active_mocker-1.2.pre.9 lib/active_hash/ar_api.rb
active_mocker-1.2.pre.8 lib/active_hash/ar_api.rb
active_mocker-1.2.pre.7 lib/active_hash/ar_api.rb
active_mocker-1.2.pre.6 lib/active_hash/ar_api.rb
active_mocker-1.2.pre.5 lib/active_hash/ar_api.rb
active_mocker-1.2.pre.4 lib/active_hash/ar_api.rb
active_mocker-1.2.pre.3 lib/active_hash/ar_api.rb
active_mocker-1.2.pre.2 lib/active_hash/ar_api.rb
active_mocker-1.2.pre.1 lib/active_hash/ar_api.rb
active_mocker-1.2.pre lib/active_hash/ar_api.rb
active_mocker-1.1.23 lib/active_hash/ar_api.rb
active_mocker-1.1.22 lib/active_hash/ar_api.rb
active_mocker-1.1.21 lib/active_hash/ar_api.rb
active_mocker-1.1.20 lib/active_hash/ar_api.rb
active_mocker-1.1.11 lib/active_hash/ar_api.rb
active_mocker-1.1.10 lib/active_hash/ar_api.rb