Displaying 2 results from an estimated 2 matches for "operations_us".
Did you mean:
operations's
2005 Aug 28
6
ActiveRecord Question
...er < ActiveRecord::Base
has_and_belongs_to_many :operations
end
class Operation <ActiveRecord::Base
belongs_to :operation_type,
has_and_belongs_to_many :users
end
class OperationType <ActiveRecord::Base
has_many :operations
end
And I have users, operations, operations_users (join table) & operation_types tables as needed.
Now for a given user, I want to fetch all the types of the operations associated with her (OperationType classes).
So there is one very inefficient way that goes like this:
(suppose user_id holds the user id)
user = User.find(user_id)
user...
2005 Aug 28
1
Active Record problem
...er < ActiveRecord::Base
has_and_belongs_to_many :operations
end
class Operation <ActiveRecord::Base
belongs_to :operation_type,
has_and_belongs_to_many :users
end
class OperationType <ActiveRecord::Base
has_many :operations
end
And I have users, operations, operations_users (join table) & operation_types tables as needed.
Now for a given user, I want to fetch all the types of the operations associated with her (OperationType classes).
So there is one very inefficient way that goes like this:
(suppose user_id holds the user id)
user = User.find(user_id)
user...