Displaying 4 results from an estimated 4 matches for "tournament_id".
2007 Jan 01
5
Validations based on associations
My model is very simple, it''s mostly just a join table that represents
which tournaments a user has registered for.
class Registration < ActiveRecord::Base
belongs_to :user
belongs_to :tournament
validates_presence_of :user_id, :tournament_id
validates_uniqueness_of :user_id, :scope => :tournament_id
end
the validates_uniqueness checks to make sure there''s no record that
has the same user_id and tournament_id.
Is there a relatively easy way to specify this behavior? The only way
that I know is to do something like
cont...
2008 Jan 27
4
(REST) Nested routes
...has_many :tournaments, :through => :team_tournaments
has_many :team_tournaments
class TeamTournament < ActiveRecord::Base
belongs_to :team, :foreign_key => ''team_id''
belongs_to :tournament, :class_name => ''League'', :foreign_key =>
''tournament_id''
class Tournament < ActiveRecord::Base
has_many :teams, :through => :team_tournaments
has_many :team_tournaments
So it''s a N-M relationship between Team and Tournament through
TeamTournaments.
Well, I want to have nested routes from Team to Tournament:
teams/1/tourna...
2006 Jun 18
5
on change of drop down showing a new textfield
hi,
i have a situation where i have a list of options from which a user selects
his options if its not in the list he/she selects Others/Not Present and a
new textfield should pop up and the data entered there should be considered
instead of dropdown.
i have done this using javascript/dhtml but i was wondering how this can be
done using pure rails i.e using some of the RoR apis?.
i would
2008 Jan 18
8
link_to problem
hi @ all
I create a new archiv.html.erb and a archiv method in the controller.
Now, I would like to link from index.html.erb to archiv.html.erb. I
tried to use <%= link_to ''archive'', archiv_xxx_path %> but it doesn''t
run.
It appears a error message "SyntaxError in xxx#index".
Does anyone know, how I can enhance this problem?
thanks a lot...
--
Posted