Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

howto: indexing habtm models? #3

Open
dkindlund opened this issue May 25, 2009 · 1 comment
Open

howto: indexing habtm models? #3

dkindlund opened this issue May 25, 2009 · 1 comment

Comments

@dkindlund
Copy link

Can you provide an example on how to properly index fields in the (automagically generated) "join" table that rails creates when 2 models are declared as habtm?

For example:
class Role < ActiveRecord::Base

has_and_belongs_to_many :users

end

class User < ActiveRecord::Base

has_and_belongs_to_many :roles

end

Then, how do I properly index the "role_id" and "user_id" columns in the automatically generated "roles_users" table?

It seems that cache-money requires index declarations in all models, but the problem is, there's no actual model file declared for the "roles_users" table. So, do I need to manually create the model file...? Or is there some other way to accomplish what I want?

Thanks.

@nkallen
Copy link
Owner

nkallen commented May 27, 2009

I don't think there's a way to accomplish this right now :( . Try digging through the HABTM code and see if you can write a patch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants