On 9 October 2012 17:29, Eugeni Kurtov <li...@ruby-forum.com> wrote:
> 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

You need belongs_to metting and player here.

> 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 all meetings in the specified city  together with their
> addresses and players?

By a city do you mean a Place or a string in player.city?

Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to