On Wednesday, June 6, 2012 12:09:16 PM UTC-7, lkfken wrote: > > Hi, > > I have 2 models as follows: > > class IexRecord < Sequel::Model(DB_SQLITE) > one_to_many :eligibility_data, :key => :source > #Note: the original primary in the table was :id, but I set it to > :source in other to get the Many-to-One association filter to work. > set_primary_key :source >
First, for problems like this, always post your database schema, as it makes it much easier to diagnose the issue. You probably don't want to override the primary key manually. If you really do want to override it manually, you should override it before defining the association, not after. With the way you did things, at the time the association is defined, it looks for the primary key, which would be :id, and caches it. If you just want to change which primary key is used for that association, without changing the model's actual primary key, use the :primary_key association option. Thanks, Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/sequel-talk/-/A9DJx-snfcQJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en.
