Phlip wrote: > Merbies: > > I am experimenting with wolfmanblog, and I got stuck on fixtures. Here's some > of > his Post model: > > class Post < Sequel::Model > many_to_many :tags >
This is an issue with Sequel. You can only add associations to a saved record. There is several ways of getting around this, the simplest is probably to just define a new create method on the model that removes the :tags key from the hash, calls the original create method using super, then create the tag records on the model using the previously removed :tags key. This will only help when using create though, a better solution is to define a new initialize method, but the tags have to be stored away until after the record is saved though. The method you are using would probably work fine if you were using datamapper instead. If you are still stuck, you could always try looking for a fixture framework designed to use sequel more appropriately. Derek --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "merb" group. 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/merb?hl=en -~----------~----~----~----~------~----~------~--~---
