The naming of associations, so that you have an association of both multiple and singular forms of the model name, can be confusing, it can also override the method. Best practice aside, you usually don't need to supply raw SQL. Your case is no exception.
, MyModel . , , "-" "", - :
, SQL:
class User < ActiveRecord::Base
has_many :my_models
has_many :locations
end
class Location <ActiveRecord::Base
belongs_to :my_model
belongs_to :user
end
class MyModel < ActiveRecord::Base
has_many :locations
belongs_to :user
has_one :user_location, through => :user, :source => :location
end
, , . , .