-
Notifications
You must be signed in to change notification settings - Fork 188
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
How should I override SubscriptionsController? #165
Comments
I see that I can override this by setting |
@ericgross I suggest monkey-patching or submitting a PR where you change the koudoku code to allow that |
I did that putting this Gem in the Gemfile of my app:
and creating a file called app/decorators/controllers/koudoku/subscriptions_controller_decorator.rb with custom overrides such as:
Hopes this helps |
I recently implemented gem "rails_engine_decorators" for the reason above, and besides local development, it is incompatible with Rails 5. It gives the error DEPRECATION WARNING: alias_method_chain is deprecated. Just a heads up to anyone else who finds this. |
@gwalshington I'm also on Rails 5. What you can do is, and which is actually much easier, is to This works because if you look at Koudoku's Subscription Controller here: https://github.com/andrewculver/koudoku/blob/master/app/controllers/koudoku/subscriptions_controller.rb#L178 it checks for a superclass delegate method. If the superclass does not have an implementation of To use your own path add the following to your def after_new_subscription_path(owner, subscription)
# Decide where you want to send the user.
# This is using the root / url as an example
main_app.root_path
end Now, when a new subscription is created your code will be invoked because https://github.com/andrewculver/koudoku/blob/master/app/controllers/koudoku/subscriptions_controller.rb#L178 see's that you have an implementation in the superclass. I hope that helps! 😄 |
I'd like to set a different path in
after_new_subscription_path
- what is the best way to do that?The text was updated successfully, but these errors were encountered: