Hello! Anybody know what's up with this routing er...
# support
t
Hello! Anybody know what's up with this routing error?
uninitialized constant Spree::HomeController Did you mean? Spree::HomeControllerDecorator
when going to https://localhost:3000/marketplace --
Copy code
# config/routes.rb
mount Spree::Core::Engine, at: "/marketplace"
get "/marketplace", to: "spree/home#index"

--

# rails routes
          spree    /marketplace Spree::Core::Engine
marketplace GET    /marketplace(.:format) spree/home#index
e
👋 is the home controller present in app/controllers? if yes I suggest checking for petty typos
t
Isn't the home controller part of solidus-core? I can't remember having had to generate one in previous installs 🙏 Cheers!
e
Spree::HomeController
was part of the legacy
solidus_frontend
, currently a new install will use
solidus_starter_frontend
and will add it to the rails app itself without the
Spree::
namespace
running
ls app/controllers
should clarify the situation
t
Ah, that makes perfect sense! Thank you! 🙏 I chose not to install any front-ends because I'd like to reuse my own from a previous project 👍
e
in that case you probably want to add back solidus_frontend to the gemfile or, even better, copy over all the views and controllers from it and merge in all the
_decorator.rb
files
t
Is there any way I can achieve this without installing
solidus_starter_frontend
? I'm using Propshaft instead of Sprockets and the two seem to be conflicting ☺️
I actually got my own views and stuff. Spent a loooong time cleaning up
solidus_frontend
👍
e
oh that’s perfect, I think most stores ended up doing that, I’m unsure why you want to use solidus_starter_frontend if you already have all the views… is it for the controllers?
t
No, I don't want to use
solidus_starter_frontend
or
solidus_frontend
🙂
I guess I should read through the
solidus_frontend
install script and manually apply the applicable steps or something?
e
so if you’re just missing the controllers you should copy them over from solidus_frontend, something like
gem install solidus_frontend
gem open solidus_frontend
should open the gem dir in your editor without adding it to the bundle
t
Oh, that simple? Nice!
Almost there -- any chance you know how to fix
NoMethodError in Spree::Home#index: undefined method 'permalink' for nil:NilClass
?
solidus_frontend/app/controllers/spree/taxons_controller.rb
contains:
load_taxon
@taxon = Spree::Taxon.find_by!(permalink: params[:id])
end
e
which route? looks like it’s one asking for a taxon
t
I'll mess around with it a bit and report back 👍 Thank you so much for the help man!
🙏
e
anytime 😉
a
I have the same error when I try to login as an admin. I've installed Solidus from scratch with
solidus_starter_frontend
and I have the file
app/controllers/home_controller.rb
but it keeps failing. I had to change the
root to: 'home#index'
to make it work (instead of copying the SolidusFrontend's HomeController
e
@Andres Bernardi that’s probably a different issue, but can you share the stacktrace? It would be useful to know where the code is trying to generate that route
a
Hi @elia , thank you for your quick reply, here it is.
ActionController::UrlGenerationError in Spree::Admin::UserSessionsController#create
No route matches {:action=>"index", :controller=>"home"}
Backtrace:
Copy code
actionpack (6.1.7) lib/action_dispatch/journey/formatter.rb:44:in `path'
actionpack (6.1.7) lib/action_dispatch/routing/route_set.rb:823:in `url_for'
actionpack (6.1.7) lib/action_dispatch/routing/route_set.rb:270:in `call'
actionpack (6.1.7) lib/action_dispatch/routing/route_set.rb:213:in `call'
actionpack (6.1.7) lib/action_dispatch/routing/route_set.rb:326:in `block in define_url_helper'
devise (4.8.1) lib/devise/controllers/helpers.rb:182:in `signed_in_root_path'
devise (4.8.1) lib/devise/controllers/helpers.rb:216:in `after_sign_in_path_for'
solidus_auth_devise (2.5.5) lib/controllers/backend/spree/admin/user_sessions_controller.rb:20:in `block (2 levels) in create'
actionpack (6.1.7) lib/action_controller/metal/mime_responds.rb:214:in `respond_to'
solidus_auth_devise (2.5.5) lib/controllers/backend/spree/admin/user_sessions_controller.rb:17:in `create'
The
signed_in_root_path(resource_or_scope)
where
resource_or_scope
is Spree::User (the admin) returns
root_path
e
@Andres Bernardi This is a legit bug, I also tried with this PR https://github.com/solidusio/solidus_auth_devise/pull/231 but it didn’t solve it either
v2.5.4 of solidus_auth_devise seems to not have this issue, so for the time being you can use
gem "solidus_auth_devise", "< 2.5.5"
in your gemfile
1
a
Thank you, hope this helps anyone else. 🙌
e
We should be releasing v2.5.6 soon reverting the change that caused this, see https://github.com/solidusio/solidus_auth_devise/pull/232 for updates