Sabo
04/04/2023, 1:31 PMSpree::Admin::ImagesController
but I get the error AbstractController::ActionNotFound (The action 'index' could not be found
Indeed by looking in Spree:Admin:ImagesController and Spree:Admin:ResourceController I don't find a index function, I wonder where and how the index action is defined ?rainer
04/04/2023, 2:43 PMimages#index
route is available due to the current route definition here:
https://github.com/solidusio/solidus/blob/v3.2.2/backend/config/routes.rb#L42-L46
(here is an example of all the routes created through a resources
definition)
Is it possible that you are unintentionally trying to perform the index action in your fork?Sabo
04/05/2023, 10:32 AMimages#index
I (think) understand how the roads are made, but I don't understand how the index action of Spree::Admin::ImagesController
work because it's not defined neither in ImagesController nor in ResourceController
For the "fork" in my route.rb I have:
namespace :admin do
resources :kits do
resources :images, controller: 'images_kit' do
post :update_positions, on: :collection
end
end
end
and
admin_kit_images GET /admin/kits/:kit_id/images(.:format) spree/admin/images_kit#index
Perhaps because I changed the controller name to '_images_kit'_ (the fork) the view in admin/images/index is not found ?rainer
04/05/2023, 1:57 PMPerhaps because I changed the controller name to β_images_kitβ_ (the fork) the view in admin/images/index is not found ?Yes I think you are right π I quickly tried to remove the admin/images/index.html.erb and I got the same exception, you may need to try adding a dedicated admin/images_kit/index.html.erb view in your scenario
Sabo
04/06/2023, 8:09 AMNameError in Spree::Admin::ImagesKitController#index
uninitialized constant Spree::ImagesKit
Extracted source (around line #280)
# unknown.
def constantize(camel_cased_word)
Object.const_get(camel_cased_word)
end
activesupport (7.0.4) lib/active_support/inflector/methods.rb:280:in `const_get'
rainer
04/06/2023, 10:48 AMmodel_class
method in `Spree:Admin:ResourceController`:
https://github.com/solidusio/solidus/blob/v3.2.2/backend/app/controllers/spree/admin/resource_controller.rb#L144-L146
In your case, starting from the controller name, model_class
is probably trying to constantize "Spree::ImagesKit"
.
If you want to continue using the Spree::Image
model, in your Spree::Admin::ImagesKitController
you can override the model_class
method with something like this:
private
def model_class
Spree::Image
end
Sabo
04/06/2023, 12:00 PM