Sha256: 9f8dd080ad4d66cc163377d4baea5f5127ad1f3afff830d81e01e61bd3b38ad0

Contents?: true

Size: 502 Bytes

Versions: 17

Compression:

Stored size: 502 Bytes

Contents

module ActiveRecord
  class Fixture
    def find
      raise FixtureClassNotFound, "No class attached to find." unless model_class
      model_class.unscoped do
        # CPK
        #model_class.find(fixture[model_class.primary_key])
        ids = self.ids(model_class.primary_key)
        model_class.find(ids)
      end
    end

    def ids(key)
      if key.is_a? Array
        key.map {|a_key| fixture[a_key.to_s] }
      else
        fixture[key]
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
composite_primary_keys-13.0.1 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-13.0.0 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-12.0.10 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-12.0.9 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-12.0.8 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-12.0.6 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-12.0.5 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-12.0.4 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-12.0.3 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-12.0.2 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-12.0.1 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-12.0.0 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-12.0.0.rc5 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-12.0.0.rc4 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-12.0.0.rc3 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-12.0.0.rc2 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-12.0.0.rc1 lib/composite_primary_keys/fixtures.rb