composite-primary-keys / composite_primary_keys

Composite Primary Keys support for Active Record
1.03k stars 351 forks source link

NoMethodError: undefined method `to_sym' for :CompositePrimaryKeys::CompositeKeys #238

Closed amitej1 closed 8 years ago

amitej1 commented 10 years ago

When trying to use the populator gem to generate random data for a model having composite keys, this error is returned. I tried searching for similar issues, and found one in #134 and #137, but the fix mentioned there does not exist anymore. I understand that this issue has been resolved in the latest version of the composite_primary_keys gem 7.0.10, but I cannot update my version to that as I'm using rails version 4.0.2 for my project. The version I'm using is 6.0.6, and I'm trying to run the following code :

  CompetitionCoupon.populate comp.no_of_winners do |comp_coupon|

   comp_coupon.coupon_expiry_date = expiry_date
    comp_coupon.coupon_id                 = coupons.sample.coupon_id

    comp_coupon.id = [position, comp.id]
    position+=1
  end

And, I receive the following error : NoMethodError: undefined method `to_sym' for ["position", "competition_id"]:CompositePrimaryKeys::CompositeKeys

Is there any resolution for this on version 6.0.6?

cfis commented 10 years ago

Do you have a trackeback? Happy to take accept a patch if you want to backport one. Most focus is now on Rails 4.1 and Rails 4.2.

cfis commented 8 years ago

Going to close this since its so old.