Reputation: 275
I'd like to redirect /cart
to my homepage in Spree 2.0. I tried to use:
Spree::Core::Engine.routes.draw do
get '/cart' => redirect("/")
end
in my route.rb but rails keep complaining I'm duplicating my route. Obvisouly that's not the right method. How should I do? (prepend or append didn't work either).
Thank you
Upvotes: 2
Views: 504
Reputation: 15992
I am not sure if there is any way of overriding routes, but this is how I ended up doing this in my application (in app/spree/controllers/orders_controller_decorator.rb):
module Spree
OrdersController.class_eval do
before_filter :redirect_to_root, only: [:cart]
private
def redirect_to_root
redirect_to root_path
end
end
end
I would still be interested to know if somebody has done with overriding routes. :)
Upvotes: 1