Hi folks,
I'm trying to filter my AS List view so that only some records appear.
The problem I have is how to get the parent model included in the
child's find(:all) which is used in List view.
models:
:report belongs_to :user
:user has_many :reports
class ReportsController < ApplicationController
def conditions_for_collection
@region_list = current_user.region.self_and_descendants.collect {|x|
x.name} #this works
[" '#{user.region.name}' IN (?)", @region_list] #this doesn't work
end
The error I get is:
undefined local variable or method `user' for #<ReportsController:
0x103243250>
How do I include the User model association in the
conditions_for_collection? Do I need to write custom SQL, and if so,
where would I put that code?
Thanks,
Jeff
--
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.