Sha256: df18061b4a2ea78e03d7bdd7c9768228f4d4c1e106f3a09c1cd777b53db09d5d

Contents?: true

Size: 481 Bytes

Versions: 16

Compression:

Stored size: 481 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

16 entries across 16 versions & 1 rubygems

Version Path
composite_primary_keys-14.0.9 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-14.0.8 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-13.0.8 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-14.0.7 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-14.0.6 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-13.0.7 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-13.0.6 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-14.0.5 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-13.0.5 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-13.0.4 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-14.0.4 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-14.0.3 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-13.0.3 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-14.0.2 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-13.0.2 lib/composite_primary_keys/fixtures.rb
composite_primary_keys-14.0.1 lib/composite_primary_keys/fixtures.rb