Why isn't the composite_primary_keys gem for Rails working?

删除回忆录丶 提交于 2019-12-23 15:50:38

问题


I've followed the instructions here, installing the composite_primary_keys gem via

sudo gem install composite_primary_keys

That worked fine. Now when I add the following to my model

set_primary_keys :user_id, :group_id

and I get

undefined method `set_primary_keys' for #<Class:0x1043bfe20>

Also, using multiple primary keys in a migration as described here has no effect.

Any ideas why this might not be working and how to make it work?

Note: I do not want a speech on why I should not be using composite keys--I have already made up my mind and just want to get this working. Thanks!


回答1:


Did you add require 'composite_primary_keys' to the bottom of your environment.rb file as described here?



来源:https://stackoverflow.com/questions/2388995/why-isnt-the-composite-primary-keys-gem-for-rails-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!