Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate Spree::UsersController #63

Open
hardreggaecafe opened this issue Dec 11, 2019 · 3 comments
Open

Migrate Spree::UsersController #63

hardreggaecafe opened this issue Dec 11, 2019 · 3 comments

Comments

@hardreggaecafe
Copy link

I'm implementing spree_product_subscriptions to spree 3.7.
And I've encountered this error.

myapp/vendor/bundle/ruby/2.5.0/bundler/gems/spree_product_subscriptions-2dd9d1467f2b/app/controllers/spree/users_controller_decorator.rb:1:in `<top (required)>': uninitialized constant Spree::UsersController (NameError)

And users_controller_decorator.rb which described above is here.

Spree::UsersController.class_eval do

  before_action :load_subscriptions, only: :show

  private

    def load_subscriptions
      @orders = @user.orders.complete.order(completed_at: :desc)
      @subscriptions = Spree::Subscription.active.order(created_at: :desc).with_parent_orders(@orders)
    end

end

Actually, I have my own users already. What should I do?

@babgyy
Copy link

babgyy commented Feb 28, 2020

I have the same error with Spree 3.7.4 when running the install rake command

bundle exec rails g spree_product_subscriptions:install

Is Spree 3.7.4 supported ?

@rajneeshsharma9
Copy link

@babgyy Unfortunately this extension is only working fine for spree versions up to 3.5.

We do plan to upgrade this extension in the future. Meanwhile, if you have already fixed the issues in upgrades, you can raise a pull request and we will review and merge it.

Also, you can try using https://github.com/hardreggaecafe/spree_product_subscriptions/tree/migrate_for_3.7.2 by @hardreggaecafe for your Spree 3.7.4 compatibility until we have officially upgraded the extension.

@babgyy
Copy link

babgyy commented Apr 10, 2020

Thanks ! I have indeed been making progress with this https://github.com/hardreggaecafe/spree_product_subscriptions/tree/migrate_for_3.7.2 fork.

The other problems I had :

  • There is an implicit dependency on spree-frontend, on which my project does not depend. Which mean OrdersController and UsersController are not defined. Easily solved
  • This contrib also does not support a customized checkout_flow. If adding or removing steps, the order cloning when renewing a subscription will not work. A bit tougher but I could make it work with conditional statements

In the end (as often I guess), my business requirements ended up differing a lot from what this contrib does, so I rewrote a lot of code.

I would be glad to open a pull request when I am done if you want me to, but I didn't care that much about backward compatibility, yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants