hi,
When i am trying to render the data from the table i am getting the
following error
Action Controller: Exception caught
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.items
app/views/categories/_list.rhtml:13:in
`_run_erb_47app47views47categories47_list46rhtml'
app/views/categories/index.html.erb:9:in
`_run_erb_47app47views47categories47index46html46erb'
app/controllers/categories_controller.rb:18:in `index'
:1:in `initialize'
please help me in this
On Wed, Nov 12, 2008 at 12:11 AM, Vince <[EMAIL PROTECTED]> wrote:
>
> 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
-~----------~----~----~----~------~----~------~--~---