Hello,
Perhaps someone knows the answer to this one, because its been
stumping me for a long time.
BTW, i’m still using rails 3.0.0, perhaps this issue is solved in a
recent release.
Here are my Models
class Team < ActiveRecord::Base
has_many :players
…
end
class Player < ActiveRecord::Base
belongs_to :team
has_many :jerseys
…
end
class Jersey < ActiveRecord::Base
belongs_to :player
…
end
In the console (or in any of my methods), I would like to list all the
Teams that have Players with Jerseys that are XL or higher
IF I JUST WANT A COUNT OF THE TEAMS, THIS WORKS
console > Team.includes(:players => :jerseys).where(“jerseys.size in
(?)”,[‘XL’,XXL’]).count
console > 15
HOWEVER, WHEN I WANT TO GET A COLLECTION IT FAILS WITH THE FOLLOWING
MESSAGE
console > Team.includes(:players => :jerseys).where(“jerseys.size in
(?)”,[‘XL’,XXL’]).all
error message I receive
“ActiveRecord::ConfigurationError: Association named ‘jerseys’ was not
found; perhaps you misspelled it?”
What am i doing wrong? This seems like a bug, doesn’t it??
Any help is appreciated!