ok, i made it. Kinda nasty i think, but if someone else is interested, i
passed as a virtual column and add stub to let it work in the model:
attr_accessible :some_var
@internal = nil
def some_var
return @internal unless @internal.nil?
u = budget.try(:order).try(:some_var)
return nil unless u
@internal = u #this is for caching the value from the "create" in the
parent form
end
def some_var=(val)
@internal = val == "true" ? true : false
end
And in the controller:
conf.columns.add :some_var
conf.create.columns << :some_var
conf.columns[:some_var].form_ui = :hidden
On Fri, Mar 1, 2013 at 3:26 PM, Hernan Astudillo <[email protected]> wrote:
> having this structure (has-many -> belongs_to)
>
> order->budget->item->product
>
> when creating a budget, i add an item, and choose a product. The price
> depends on a checkbox in Order, but i have no way to access that from the
> new item (which parent is also new)
>
> However, the "create new budget" link has an "order_id" param but there is
> nothing on active_scaffold_storage nor active_scaffold_config to retrieve
> it.
>
> Is there a way to access this value, or pass it from form to subform as a
> hidden value, or url param, using virtual column or whatever other way?
>
> thanks in advance
>
--
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/activescaffold?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.