Sha256: 97f7b2d0e5aac62d27b977e0c59eaf59b4e53d5944710247e3f43f1b28594f40

Contents?: true

Size: 489 Bytes

Versions: 1

Compression:

Stored size: 489 Bytes

Contents

module ActiveRecord
  class Fixture
    def find
      if model_class
        # CPK
        # model_class.find(fixture[model_class.primary_key])
        ids = self.ids(model_class.primary_key)
        model_class.find(ids)
      else
        raise FixtureClassNotFound, "No class attached to find."
      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

1 entries across 1 versions & 1 rubygems

Version Path
composite_primary_keys-7.0.16 lib/composite_primary_keys/fixtures.rb