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

Doesn't work with composite_primary_keys gem #214

Closed
MichaelSp opened this issue Mar 18, 2015 · 0 comments
Closed

Doesn't work with composite_primary_keys gem #214

MichaelSp opened this issue Mar 18, 2015 · 0 comments

Comments

@MichaelSp
Copy link

While running user.permissions_users.each do |permission| ... I get this:

TypeError - ["user_id", "permission_id"] is not a symbol:
  bullet (4.14.4) lib/bullet/ext/object.rb:8:in `primary_key_value'
  bullet (4.14.4) lib/bullet/detector/n_plus_one_query.rb:28:in `add_possible_objects'
  bullet (4.14.4) lib/bullet/active_record42.rb:109:in `load_target'
  activerecord (4.2.0) lib/active_record/associations/collection_proxy.rb:44:in `load_target'
  activerecord (4.2.0) lib/active_record/associations/collection_proxy.rb:939:in `to_ary'
  activerecord (4.2.0) lib/active_record/relation/delegation.rb:46:in `each'

This is my permissions_user model:

class PermissionsUser < ActiveRecord::Base
  self.primary_keys = :user_id, :permission_id
  enum state: [:inherit, :no, :yes]

  belongs_to :user
  belongs_to :permission

  validates_uniqueness_of :user_id, scope: [:permission_id]
  validates_presence_of :user_id, :state, :permission_id
end
hannahbot-zz pushed a commit to hannahbot-zz/bullet that referenced this issue Sep 18, 2015
* flyerhzm/master:
  Auto corrected by following Style/DeprecatedHashMethods
  Reduce object count
  start? should check enable?
  Rename to mongoid 5.0.0-pre.
  Use Travis' container-based infrastructure.
  Backport the Query-after-Create fix to AR4.1 and AR4.0.
  Do not report association queries immediately after object creation to require a preload.
  README: fix typo
  add note in README that bullet gem must be added after AR and mongoid flyerhzm#222
  support mongoid 5.0.0
  Removed circular argument reference error
  Bumping version to 4.14.8
  instruct how to skip bullet in controller action
  compatible with composite_primary_keys gem flyerhzm#214
  Bumping version to 4.14.7
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