Spree Overriding Users Registration Controller

823 views Asked by At

I'm currently working on a spree pet project, where looking at the documentation was trying to override the default spree user registration controller. I'm currently using

 gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '3-0-stable'

the authentication provided by spree. The issue is that after overriding the controller, it is not hitting that specific new method. Here is what I have done.

In my app, /controller/spree/user_registrations_controller_decorator.rb

Spree::UserRegistrationsController.class_eval do
    def new
        build_resource({})
        resource.user_login_upload = UserLoginUpload.new
        respond_with resource
    end

    def create
        super
    end
end

When I refresh my browser, it is hitting the spree sign_up(new) method, not my overridden one. what am I doing wrong, any insights would be helpful.

Thanks In Advance.

1

There are 1 answers

0
Noah Butler On
module Spree
  UserRegistrationsController.class_eval do
    # any action overrides like they have above
  end
end

save in app/controllers/spree/ as user_registrations_controller_decorator.rb

For anyone else that finds themselves in this section of the galaxy.