Created
October 29, 2014 17:29
-
-
Save deivid-rodriguez/869c5468cedd35afd4bf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model Token | |
include Mongoid::Document | |
field :user_id | |
end | |
model User | |
include Mongoid::Document | |
has_many :tokens | |
end | |
# In the Rails console this works... | |
$ Token.where(user_id: Token.first.user_id).first | |
#<Token _id: ...> | |
# I feel tempted to add `belongs_to :user` to the token model, but after doing so... | |
$ Token.where(user_id: Token.first.user_id).first | |
nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment