Hello,

I have the following scenario:
class User; has_and_belongs_to_many :roles; end
class Role; has_and_belongs_to_many :users; end
#roles schema only has name (string) as attribute
an additional table 'roles_users' with user_id (integer) and role_id
(integer) was necessary.
Then I created a fixture in users.yml:
admin:
  roles: admin, guest
and in roles.yml:
guest:
  name: guest
admin:
  name: admin

This should work as mentioned in the docs:
http://api.rubyonrails.org/classes/Fixtures.html
But the following line did not pass:
assert_not_nil users(:admin).roles.find_by_name('admin')
Because users(:admin).roles is empty!

For the problem I crawled a lot of docs but I cannot see where I made
a mistake.
Could someone lead me in the right direction?

Regards,
Peter.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to