I'm having some difficulty with associations in datamapper - hopefully someone can show me where my misunderstanding lies...
I have two models related by a many to many association via a join model. --- class Subscription include DataMapper::Resource property :id, Serial has n, :profiles has n, :users, :through => :profiles --- class User include DataMapper::Resource property :id, Serial has n, :profiles has n, :subscriptions, :through => :profiles --- class Profile include DataMapper::Resource property :subscription_id, Integer, :key => true property :user_id, Integer, :key => true belongs_to :subscription belongs_to :user --- Then in the controller I attempt to instantiate a subscription and user and associate them... --- def some_action @subscription = Subscription.create @user = User.create @subscription.users << @user end --- When I point my browser at this action, I get the following - Immutable Association Error 500 You can not modify this association I've tried the same association operation with ActiveRecord in Rails and it works fine there. Evidently there's something different about datamapper that I don't understand. Any suggestions would be much appreciated. Mark. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "DataMapper" 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/datamapper?hl=en -~----------~----~----~----~------~----~------~--~---
