Sha256: 181bf7c875e3d2826080e49dc327abbe980f805b87da62f493806d29ed26cc4a

Contents?: true

Size: 1.1 KB

Versions: 11

Compression:

Stored size: 1.1 KB

Contents

= Composite Primary Keys for ActiveRecords

== Summary

ActiveRecords/Rails famously doesn't support composite primary keys.
This RubyGem extends the activerecord gem to provide CPK support.

== Installation

    gem install composite_primary_keys

== Usage

    require 'composite_primary_keys'
    class ProductVariation
      self.primary_keys = :product_id, :variation_seq
    end

    pv = ProductVariation.find(345, 12)

== Factories

    class ModelWithCompositeKeys < ActiveRecord::Base
      set_primary_keys :id, :updated_at
    end

    FactoryGirl.define do
      factory :model_with_composite_keys do
        sequence( :id ) { |n| [n,Time.now] }
        name "Brett"
      end
    end


It even supports composite foreign keys for associations.

See http://compositekeys.rubyforge.org for more.

== Running Tests

See test/README_tests.rdoc

== Url

http://compositekeys.rubyforge.org

== Questions, Discussion and Contributions

http://groups.google.com/group/compositekeys

== Author

Written by Dr Nic Williams, drnicwilliams@gmail.
Contributions by many!

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
composite_primary_keys-5.0.14 README.rdoc
composite_primary_keys-6.0.1 README.rdoc
composite_primary_keys-6.0.0 README.rdoc
composite_primary_keys-5.0.13 README.rdoc
composite_primary_keys-5.0.12 README.rdoc
composite_primary_keys-5.0.11 README.rdoc
composite_primary_keys-5.0.10 README.rdoc
composite_primary_keys-5.0.9 README.rdoc
composite_primary_keys-5.0.8 README.rdoc
composite_primary_keys-5.0.6 README.rdoc
composite_primary_keys-5.0.5 README.rdoc