title: Ruby error no such file to load -- composite_primary_keys
body: <p>I'm new to Rails but I need to use a composite primary key in my app running Ruby 1.9.2 and Rails 3.  I am not able to get composite keys working properly in my Ruby on Rails app.  I've followed the directions in <a href="http://compositekeys.rubyforge.org" rel="nofollow noreferrer">the compositekeys site</a> but I'm still getting the same error: 
      no such file to load -- composite_primary_keys</p>
  
  <p>1 - sudo gem install composite_primary_keys<br>
  2 - Add the require 'composite_primary_keys' at the end of the conf/environment.rb file<br>
  3 - Added the set_primary_keys  </p>
  
  <p>My gem list looks like this:</p>
  
  <pre><code>abstract (1.0.0)
  actionmailer (3.0.1)
  actionpack (3.0.1)
  activemodel (3.0.3, 3.0.1)
  activerecord (3.0.1)
  activeresource (3.0.1)
  activesupport (3.0.3, 3.0.1)
  arel (2.0.3, 1.0.1)
  builder (2.1.2)
  bundler (1.0.3)
  composite_primary_keys (2.3.5.1)
  </code></pre>
  
  <p>My domain class looks like this:</p>
  
  <pre><code>class Radioreport &lt; ActiveRecord::Base
    set_primary_keys :service_id, :date_id
    belongs_to :report_date, :foreign_key =&gt; "date_id"
    belongs_to :service, :foreign_key =&gt; "service_id"
    ...
  </code></pre>
  
  <p>And my environment file looks like this:</p>
  
  <pre><code> # Load the rails application
   require File.expand_path('../application', __FILE__)
   # Initialize the rails application
   Upreports::Application.initialize!
   require 'composite_primary_keys'
  </code></pre>
  
  <p>The error that I get is the following when I run my 'rake test':</p>
  
  <pre><code>rake aborted!
  no such file to load -- composite_primary_keys
  </code></pre>
  
  <p>The unit test is:</p>
  
  <pre><code>require 'test_helper'
  require 'rubygems'
  require 'composite_primary_keys'
  
  class RadioreportTest &lt; ActiveSupport::TestCase
    fixtures :radioreports, :services, :genres, :groups, :locations, :report_dates
    def setup
      @radioReport = Radioreport.new
    end
  
    def test_should_put_all_radios_and_totals_in_a_hash
      transactions = Radioreport.find(:all)
      reportTransactions = @radioReport.getRadioTotalsByDayMap(transactions)
      assert_not_nil(reportTransactions)
      assert_equal(2, reportTransactions.size)
      previousKey = nil
      previousValue = nil 
      reportTransactions.each{|key, value|
        if(previousKey == nil || previousValue == nil) 
          previousKey = key
          previousValue = value
        else
          assert_not_nil(key)
          assert_not_equal(previousKey, key)
          assert_not_nil(value)
          assert_not_equal(previousValue, value)
        end
      }
    end
  </code></pre>
  
  <p>I checked the following <a href="https://stackoverflow.com/questions/2388995/why-isnt-the-composite-primary-keys-gem-for-rails-working">thread</a>, but this one doesn't apply.  I already checked my rake, gem, etc.<br>
  Thanks guys! ;)</p>