Lets say I have 2 soccer teams, represented by a SoccerTeam model and
controller. Then there is player Scott who is represented by the
model and controller "Player." Now there is a many to many join
table (soccer_team_players) between SoccerTeams and Players.
What I want to do is show all SoccerTeams that Scott is a player on.
Something like:
<%= render :active_scaffold => 'soccer_team', :constraints =>
{ :soccer_team_players.player_name => "scott"}
however I get issues with .player_name that is an actual field in
the join table.. What I am hoping is that the constraint will look at
the join table.
I see you have notes on "options_for_association_conditions", but
where can I figure out how to set the AssociationReflection object and
can I set this in the render partial call?
possibly something like?
def options_for_association_conditions(association)
if association.name == :"scott"
['player_name != ?', SoccerTeamPlayers.find_by_name('scott')]
else
super
end
end
if I use that how can I pass in the conditional into the association
def options_for_association_conditions(association)
if association.name == :"scott"
['player_name != ?',
SoccerTeamPlayers.find_by_name(association.value)]
else
super
end
end
Any help would be greatly appreciated
Thanks,
Vince
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---