I'm using Squeel, and I have an odd problem. The following line runs just fine in Rails Console, but gives an error when run in the model's controller!
Issue.joins{property.users}.where{property.users.id == 1}
Issue belongs_to Property, and Property has_and_belongs_to_many Users. I'm trying to load all the issues associated with the user_id == 1.
I get the error: "undefined method `users' for nil:NilClass" when I run the line in the IssuesController, but it works in Rails Console. What's wrong?
P.S. I'm running Rails 4.0.3, Ruby 2.0.0, and Squeel 1.1.1