inertiajs / inertia-rails

The Rails adapter for Inertia.js.
https://inertia-rails.dev/
MIT License
574 stars 45 forks source link

Fix compatibility with "responders" gem (and thus "devise") #60

Closed ledermann closed 3 years ago

ledermann commented 3 years ago

In v1.9.0, the methods redirect_to(and redirect_back) were changed to be private by #56. IMHO this is not correct, because these methods are public by default:

irb(main):001:0> ApplicationController.new.public_methods.include?(:redirect_to)
=> true
irb(main):002:0> ApplicationController.new.public_methods.include?(:redirect_back)
=> true

The changed visibility causes issues when using the gem devise, which uses the gem responders internally - see this error in my PingCRM demo application:

LoginTest#test_Login_with_valid_credentials_will_be_successful:
NoMethodError: private method `redirect_to' called for #<Users::SessionsController:0x00000000009dd0>
    app/controllers/users/sessions_controller.rb:9:in `create'

This PR restores the original method visibility and adds testing against the responders gem.

bknoles commented 3 years ago

thanks @ledermann ! i'll release a new version