class Place < ActiveRecord::Base
attr_accessible :address, :city, :name, :description
has_many :meetings
end
Class Meeting < ActiveRecord::Base
attr_accessible :start_at, :place_id, :title, :end_at
belongs_to :place
has_many :participations
has_many :players, :through => :participations
end
class Participation < ActiveRecord::Base
attr_accessible :meeting_id, :player_id
end
class Player < ActiveRecord::Base
attr_accessible :id, :city, :first_name, :gear, :last_name, :email,
:password, :password_confirmation
has_many :participations
has_many :meetings, :through => :participations
end
How to select each meeting in the specified city together with its
address and amount of players?
Something like SELECT places.id AS place_id, places.name,
places.address, meetings.title, meetings.start_at, meetings.end_at,
meetings.id AS meeting_id from places, meetings where meetings.place_id
= places.id AND places.city = ‘City’;
but this query lacks amount of players.