I have models for User and Message.  Users should be able to send messages with 
multiple Users as the recipients.  Here are the associations:

User:

 has_many :received_messages, :class => "Message", :through => 
:message_recipients, :accessible => true  
  has_many :message_recipients, :dependent => :destroy, :accessible => true, 
:foreign_key => 'recipient_id'
  has_many :sent_messages, :class => "Message", :foreign_key => 'sender_id', 
:accessible => true

Message:

belongs_to :sender, :class => "User", :creator => true, :foreign_key => 
'sender_id'
  has_many :recipients, :class => "User", :through => :message_recipients, 
:accessible => true
  has_many :message_recipients, :dependent => :destroy, :accessible => true

MessageRecipient: (join model)

belongs_to :message
 belongs_to :recipient, :class => "User", :foreign_key => 'recipient_id'


I set this up, then ran hobo g migration (hobo 1.3 pre31) here is the beginning 
of the trace:

Hobo Command Line Interface 1.3.0.pre31
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/core_ext/hash/keys.rb:43:in
 `assert_valid_keys': Unknown key(s): class (ArgumentError)
        from 
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.7/lib/active_record/associations.rb:1774:in
 `create_belongs_to_reflection'
        from 
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.7/lib/active_record/associations.rb:1220:in
 `belongs_to'
        from 
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.7/lib/active_record/autosave_association.rb:137:in
 `belongs_to_without_hobo_permission_check'
        from 
/Library/Ruby/Gems/1.8/gems/hobo-1.3.0.pre31/lib/hobo/model/permissions.rb:110:in
 `belongs_to_without_accessible'
        from 
/Library/Ruby/Gems/1.8/gems/hobo-1.3.0.pre31/lib/hobo/model/accessible_associations.rb:125:in
 `belongs_to_without_creator_metadata'
        from 
/Library/Ruby/Gems/1.8/gems/hobo-1.3.0.pre31/lib/hobo/model.rb:159:in 
`belongs_to_without_test_methods'
        from 
/Library/Ruby/Gems/1.8/gems/hobo-1.3.0.pre31/lib/hobo/model.rb:163:in 
`belongs_to_without_field_declarations'
        from 
/Library/Ruby/Gems/1.8/gems/hobo_fields-1.3.0.pre31/lib/hobo_fields/model.rb:93:in
 `belongs_to'
        from 
/Users/mark/Documents/Hobo/class_management/app/models/message.rb:10


line 10 in message.rb is the belongs_to line.


Any ideas where I'm going wrong?   



-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" 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/hobousers?hl=en.

Reply via email to