Hello!

I read about named_scopes_for_collection on 
http://wiki.github.com/activescaffold/active_scaffold/api-list and have a few 
questions:

Given a model "Car" with attributes like color (string) and manufacturer 
(reference), I'd like to have a nested scaffold for Cars named e.g. "potential 
sparepart sources" showing only other cars with the same color and same 
manufacturer and filtering out the rest.

How can I dynamically add values of the current record/row to 
CarsController::named_scopes_for_collection and what would the nested link to 
that scope have to look like?

At 
http://groups.google.com/group/activescaffold/browse_thread/thread/56ea5b7cc89182aa
 
someone suggests adding a :scope parameter to config.nested.add_link, would 
that be the way to go?

I tried something similar to the following, but couldn't get any of it to 
work. Even if it did, I doubt I could just pass the color and manufacturer 
parameters from the config.nested.add_link...

named_scope :sparepartsources, lambda { |*args|
  color = args[0]
  manufacturer = args[1]
  :conditions => ['color = :color AND manufacturer >= :manufacturer',
                  :color => color, :manufacturer => manufacturer]
}

I'm confused, could you help me get on the right track, please?

thank you very much!
ben

-- 
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.

Reply via email to