I'm currently using Rails 2.0, restful_authentication and acl_system2 for a project I'm working on. I'm having a problem figuring out an ActiveRecord relationship with my models and would like some assistance. I'm going to describe my classes and explain what I'd like them to have.
class User < ActiveRecord::Base
has_and_belongs_to_many :roles
has_and_belongs_to_many :bars
end
class Role < ActiveRecord::Base
has_and_belongs_to_many :users
end
class RolesUsers < ActiveRecord::Base
end
class Hotel < ActiveRecord::Base
has_and_belongs_to_many :users
end
So I have Users that have Roles through RolesUsers and Hotel class that habtm Users. What I'd like is to be able to have Users that have different Roles at different Hotels so that a User could be a guest at one hotel and an owner at another. How can I do this?
Thanks for the newb. help.