vinsol-spree-contrib / spree_product_subscriptions

SpreeCommerce product subscription extension lets customers subscribe for a product and get it delivered at the same time every week, month or year over a predefined period of time.
http://vinsol.com/spreecommerce-subscription
MIT License
10 stars 56 forks source link

Migrate Spree::UsersController #63

Open hardreggaecafe opened 4 years ago

hardreggaecafe commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

@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 commented 4 years ago

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 :

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.