On Martes, 14 de Septiembre de 2010 12:48:58 Benjamin Adler escribió:
> I have some trouble with AS Create Another functionality. In my setup,
> "batches has_many :storage_assignments, :as => :item".
>
> When I edit an existing batch (id=2) and click on
> create-another-storage-assignment, it correctly requests
>
> /batches/edit_associated/2?association=storage_assignments&eid=...,
> causing:
> Processing BatchesController#edit_associated (for ...) [GET]
> Parameters: {"eid"=>"...", "association"=>"storage_assignments",
> "action"=>"edit_associated", "id"=>"2", "controller"=>"batches"}
>
> But when I "Create New" Batch and then click "Create Another", it requests:
>
> /batches/edit_associated?association=storage_assignments&eid=...,
> causing:
> Processing BatchesController#show (for ...) [GET]
> Parameters: {"eid"=>"...", "association"=>"storage_assignments",
> "action"=>"show", "id"=>"edit_associated", "controller"=>"batches"}
>
> yielding the error "ActiveRecord::RecordNotFound (Couldn't find Batch
> with ID=edit_associated)".
>
> config/routes.rb contains:
> map.resources :storage_assignments, :active_scaffold => true
> map.resources :batches, :active_scafffold => true
>
> I am puzzled as to why the second request (with id=edit_associated)
> invokes the controller's show-method, while the first correctly invokes
> edit_associated! Why is that?
Do you have another line with map.resources :batches? List all routes for
batches:
rake routes CONTROLLER=batches
>
> There's another place in my app where "grid has_many :slots", and "Grids
> -> Create New -> Create Another (Slot)" works just fine. It requests:
>
> /grids/edit_associated?association=slots
> causing:
> Processing GridsController#edit_associated (for ...) [GET]
> Parameters: {"association"=>"slots", "action"=>"edit_associated",
> "controller"=>"grids"}.
>
> Is it because the first relationship is polymorphic and the second one
> isn't? Why does edit_associated end up in the controller's show action?
> How do I fix this?
>
> thanks!
> ben
--
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.