i am looking at the front-end starter's `routes.rb...
# support
e
i am looking at the front-end starter's
routes.rb
file and i see the line
Copy code
get '/checkout/:state', to: 'checkouts#edit', as: :checkout_state
but looking at the
CheckoutsController
and its superclass
CheckoutBaseController
and its superclass
StoreController
.. and on, i don't see a
def edit
so i can't figure out where this is defined.
i found this because i am trying the following in my app to create a link into the check out flow
Copy code
= link_to "Pay now", checkout_state_path(@contract.spree_order.checkout_steps.first)
k
I don’t think you need it defined if that action does nothing (except all the callbacks in the inheritance chain of course). It will just render the corresponding
:edit
view.
Are you having any issue with that
link_to
?
e
I am, it throws an exception in the app i am trying to build based on the front end starter when i link to the non-existent edit action because the edit method is missing.
k
can you please paste the full stacktrace and your config/routes.rb file? 🙏
e
Copy code
Rails.application.routes.draw do
  passwordless_for :accounts

  root to: "pages#show"

  mount Spree::Core::Engine, at: "/"

  mount SolidusStripe::Engine, at: "/solidus_stripe"

  # non-restful checkout stuff
  patch "/checkout/update/:state", to: "checkouts#update", as: :update_checkout
  get "/checkout/:state", to: "checkouts#edit", as: :checkout_state
  get "/checkout", to: "checkouts#edit", as: :checkout

  get "/unauthorized", to: redirect("/")
end
Copy code
Failures:

  1) Contract lifecycle with RLS Creates a contract
     Failure/Error: raise ActionNotFound.new("The action '#{action}' could not be found for #{self.class.name}", self, action)

     AbstractController::ActionNotFound:
       The action 'edit' could not be found for CheckoutsController
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/actionpack-7.0.5/lib/abstract_controller/base.rb:146:in `process'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/actionview-7.0.5/lib/action_view/rendering.rb:39:in `process'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/actionpack-7.0.5/lib/action_controller/metal.rb:188:in `dispatch'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/actionpack-7.0.5/lib/action_controller/metal.rb:251:in `dispatch'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/actionpack-7.0.5/lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/actionpack-7.0.5/lib/action_dispatch/routing/route_set.rb:32:in `serve'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/actionpack-7.0.5/lib/action_dispatch/journey/router.rb:50:in `block in serve'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/actionpack-7.0.5/lib/action_dispatch/journey/router.rb:32:in `each'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/actionpack-7.0.5/lib/action_dispatch/journey/router.rb:32:in `serve'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/actionpack-7.0.5/lib/action_dispatch/routing/route_set.rb:852:in `call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rack-2.2.7/lib/rack/tempfile_reaper.rb:15:in `call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rack-2.2.7/lib/rack/etag.rb:27:in `call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rack-2.2.7/lib/rack/conditional_get.rb:27:in `call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rack-2.2.7/lib/rack/head.rb:12:in `call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/actionpack-7.0.5/lib/action_dispatch/http/permissions_policy.rb:38:in `call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/actionpack-7.0.5/lib/action_dispatch/http/content_security_policy.rb:36:in `call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rack-2.2.7/lib/rack/session/abstract/id.rb:266:in `context'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rack-2.2.7/lib/rack/session/abstract/id.rb:260:in `call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/actionpack-7.0.5/lib/action_dispatch/middleware/cookies.rb:704:in `call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/actionpack-7.0.5/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.0.5/lib/active_support/callbacks.rb:99:in `run_callbacks'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/actionpack-7.0.5/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/actionpack-7.0.5/lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/actionpack-7.0.5/lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/actionpack-7.0.5/lib/action_dispatch/middleware/show_exceptions.rb:26:in `call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rails_semantic_logger-4.12.0/lib/rails_semantic_logger/rack/logger.rb:45:in `call_app'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rails_semantic_logger-4.12.0/lib/rails_semantic_logger/rack/logger.rb:28:in `call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/actionpack-7.0.5/lib/action_dispatch/middleware/remote_ip.rb:93:in `call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/actionpack-7.0.5/lib/action_dispatch/middleware/request_id.rb:26:in `call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rack-2.2.7/lib/rack/method_override.rb:24:in `call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rack-2.2.7/lib/rack/runtime.rb:22:in `call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.0.5/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/actionpack-7.0.5/lib/action_dispatch/middleware/executor.rb:14:in `call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/actionpack-7.0.5/lib/action_dispatch/middleware/static.rb:23:in `call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rack-2.2.7/lib/rack/sendfile.rb:110:in `call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/actionpack-7.0.5/lib/action_dispatch/middleware/host_authorization.rb:131:in `call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.5/lib/rails/engine.rb:530:in `call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rack-2.2.7/lib/rack/urlmap.rb:74:in `block in call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rack-2.2.7/lib/rack/urlmap.rb:58:in `each'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rack-2.2.7/lib/rack/urlmap.rb:58:in `call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rack-2.2.7/lib/rack/builder.rb:244:in `call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/capybara-3.39.1/lib/capybara/server/middleware.rb:60:in `call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/puma-5.6.5/lib/puma/configuration.rb:252:in `call'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/puma-5.6.5/lib/puma/request.rb:77:in `block in handle_request'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/puma-5.6.5/lib/puma/thread_pool.rb:340:in `with_force_shutdown'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/puma-5.6.5/lib/puma/request.rb:76:in `handle_request'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/puma-5.6.5/lib/puma/server.rb:443:in `process_client'
     # /Users/eric/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/puma-5.6.5/lib/puma/thread_pool.rb:147:in `block in spawn_thread'
     #
     #   Showing full backtrace because every line was filtered out.
     #   See docs for RSpec::Configuration#backtrace_exclusion_patterns and
     #   RSpec::Configuration#backtrace_inclusion_patterns for more information.
     # ------------------
     # --- Caused by: ---
     # Capybara::CapybaraError:
     #   Your application server raised an error - It has been raised in your test code because Capybara.raise_server_errors == true
     #   ./spec/system/support/better_rails_system_tests.rb:20:in `block (2 levels) in <top (required)>'
k
Mhh strange, I saw it’s used multiple times (even in specs and tested code): https://github.com/search?q=repo%3Asolidusio%2Fsolidus_starter_frontend%20checkout_state_path&amp;type=code
let me see if there’s some Rails configurations that trigger that in a fresh app and not in the test app
(still looking for a solution)
🙌 1
e
I wonder if it has something to do with being a link rather than a button.
is there another route i should consider to enter the checkout process instead?
k
well you could just use
checkout_path
I guess, even if that should render the same action
if you want a temporary solution, I think you can just add an empty edit action in your controller
e
i tried
checkout_path
too, same thing
Copy code
1) Contract lifecycle with RLS Creates a contract
     Failure/Error: raise ActionNotFound.new("The action '#{action}' could not be found for #{self.class.name}", self, action)

     AbstractController::ActionNotFound:
       The action 'edit' could not be found for CheckoutsController
i'll try an empty
edit
action 🤷
to make
#edit
, i should make an override ideally?
k
no, you should have the controller copied in your application already
e
ah, yes thank you
(i'm so glad it's not an engine any more!)
k
glad to hear that!
it is supposed to leave 100% flexibility