I have model TeachingPlace that belongs to Department and to the
Lecturer models and has table field called position.
I want to rid off N+1 SQL requests. There is no N+1 if
config.columns = [:lecturer, :department, :position]
Person who works with this interface is a department agent so I have
this two methods:
protected
def before_create_save(record)
if dept = current_dept_head.department
record.department_id = dept.id
end
end
def conditions_for_collection
if @dept ||= current_dept_head.department
{:department_id => @dept.id}
else
{:department_id => nil}
end
end
As you can guess I do not need to display department field in list or
anywhere in this interface because the user knows what department he
represents. But this:
config.list.columns.exclude :department
causes N+1 error. Is there any kind of descision of my trouble?
--
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.