Hi,

I've defined a polymorphic association in my models in the following
way:
class Charge < ActiveRecord::Base
  belongs_to :agent, :polymorphic => true
class ClassA < ActiveRecord::Base
  has_one :charge, :as => :agent
class ClassB < ActiveRecord::Base
  has_one :charge, :as => :agent

And I want to use record_select in the charges_controller in order to
select instances of ClassA or ClassB

I've configured record_select in ClassA, ClassB controllers and I have
set config.columns[:agent].form_ui = :record_select in
charges_controller.

Obviously this doesn't work because ActiveScaffold can't figure out
what is an Agent

The trick is that based on other conditions (i.e. the role of the
current user) I intend record_select to filter instances of only Class
A or ClassB. For example, if the current user is an admin
record_select should filter only instances of Class A, otherwise it
will filter only instances of ClassB

Is there any way to achieve this behaviour? I've tried with a form
override using record_select_field with little success so far.

Thanks in advance
Pedro

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