I have a model that belongs_to another:
class Permission
include Mongoid::Document
belongs_to :action
field :action_id, type: String
And a corresponding has_many model:
class Action
include Mongoid::Document
has_many :permissions
I am seeing that 2 basic ActiveRecord queries are not working:
First, sending the object instead of the object id does not work:
action = Action.first
permissions = Permission.where(action: action)
permissions.count # this is always 0
However, if I use the id, it works fine:
Permission.where(action_id: action.id) # this works fine
Second, sending an array of ids does not work, ever:
Permission.where(action_id: [action.id]) # always empty
Does mongoid not support basic ActiveRecord queries? If not, for the first problem, I can work around it by always using the object id, but for the second, how do I search by an array of targets?
Thanks for any help, Kevin