Hi,

Say that I have two models: "Thing", and "Item"

Thing has two columns:  "name", and "thing_type"
Item has three columns:  "thing_id", "body", "item_type"

So,  Thing has_many :items and Item belongs_to :thing

...

Is it possible to do something like this:
class ItemsController < ApplicationController
    active_scaffold :item do |config|
      config.columns[:item_type].form_ui = :select

      # pseudo code
      if config.parent_element.thing_type (meaning item.thing) ==
"Cat"
        options = [:meow, :purr]
      elsif config.parent_element.thing_type == "Dog"
        options = [:woof, :pant]
      end

      config.columns[:item_type].options = {:options => options}

....

So in other words, if I go to create a new Thing record, I'd be able
to select a thing_type "Cat" or "Dog" and then it would build an item
record for the Thing-- but give me a select with options specific for
the "Cat" or "Dog" type..

Is there any way to do this with ActiveScaffold?

Thank you.
-patrick

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