Closed GoogleCodeExporter closed 9 years ago
I figured out why it's happening, it happens for subforms on a new record because the record doesn't really
exists so instead of accessing association's model columns you access master
model columns.
Original comment by andre...@gmail.com
on 21 Jun 2009 at 2:18
What is line 6 in app/helpers/admin/order_items_helper.rb?
Original comment by sergio.c...@gmail.com
on 22 Jun 2009 at 9:57
options = active_scaffold_input_options(column)
active_scaffold_config.columns[:order_type_field] is nil if the record is new
I have Order which has many OrderItems, when I edit Order I can add OrderItems, and activescaffold
automatically add a new OrderItem by default. For the new record of OrderItems
active_scaffold_config.columns
points to Order columns not OrderItems columns as it should
Original comment by andre...@gmail.com
on 22 Jun 2009 at 12:25
active_scaffold_config is the configuration of active_scaffold in the current
controller (current controller is the controller called by current request). If
you
want to accesss active_scaffold_config for other controller use
active_scaffold_config_for(model).
Really I think the problem is active_scaffold should call override helpers with
options instead of only field's name.
Original comment by sergio.c...@gmail.com
on 22 Jun 2009 at 9:22
I see, it's a little bit confusing because the helper is for order_items_controller and that point when the record
for association is new active_scaffold_config actually contains the config for
order_controller which is for the
order model. You are right some extra parameters will be helpful, even id for
the input field because that is used
for the update_column feature. I think this all thing with associations is a
little bit hard to handle.
Original comment by andre...@gmail.com
on 22 Jun 2009 at 9:44
active_scaffold_config must contain config for OrdersController for old order
items
too, because the request is the same, so current controller must be
OrdersController
too.
If you have the helper in OrderItemsHelper, then it's being used because you
have
helper :all in your ApplicationController
I think it's needed to pass all parameters to helpers because id is sometimes
needed, I have used active_scaffold_config and active_scaffold_input_options
many
times only to get the id.
I don't know how to add the options to overrides calls: changing input_name with
options and breaking compatibility, or checking helper's arity is 3 and adding
options as third parameter.
Original comment by sergio.c...@gmail.com
on 23 Jun 2009 at 10:45
Original comment by sergio.c...@gmail.com
on 16 Sep 2009 at 10:33
Original issue reported on code.google.com by
andre...@gmail.com
on 19 Jun 2009 at 4:32