On Jueves, 6 de Mayo de 2010 16:39:47 Rio escribió:
> Hi,
>
> I'm trying to configure custom columns for a subform based on it's
> parent model.  While I can customize the fields for the child's nested
> form, I can figure out how to do this for a subform.
>
> For example, I have STI models and controllers such as:
>
>   User > Employee     #controller employees_controller.rb
>   User > Customer     #controller customers_controller.rb
>   User > Partner         #controller partners_controller.rb
>
> Then a User has_many :photos. I want to customize the columns and
> actions for :photos depending on the parent.
>
> I have both nested forms for photos and a subfrom for photos.  I'm
> able congfigure the nested form using a :before_filter in
> photos_controller.rb by checking if params[:parent_model] ==
> ModelName. However, I can't figure out how to customize the subform on
> this basis.
>
> I tried to set config.subform.columns in my before filter, but since
> the photos subform doesn't call an action on the photos_controller.rb,
> these subform customizations are never being called.  Is there any
> other way to specify my custom columns for a subform based on the
> parent_model or parent_controller?

You should put the filter in the parent controller (employee, customer or 
partner), and you will have to change PhotosController.active_scaffold_config

>
> Any help would be appreciated! Thanks!
>
> -Rio

-- 
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]

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