-
-
Notifications
You must be signed in to change notification settings - Fork 392
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
Support setting parent_controller #903
base: master
Are you sure you want to change the base?
Support setting parent_controller #903
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #903 +/- ##
=======================================
Coverage 98.91% 98.92%
=======================================
Files 14 14
Lines 555 556 +1
=======================================
+ Hits 549 550 +1
Misses 6 6 ☔ View full report in Codecov by Sentry. |
405c7c7
to
a156fb0
Compare
rebased to bring up-to-date with master. @tagliala could we get this one merged? |
a156fb0
to
78d7b34
Compare
78d7b34
to
817d23d
Compare
|
||
# Inherit from a different controller. This only has an effect if changed | ||
# before InheritedResources::Base is loaded, e.g. in a rails initializer. | ||
mattr_accessor(:parent_controller) { '::ApplicationController' } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can I ask if this is the same as
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tagliala i'd say its equivalent – the block is evaluated and the class variable is set immediately:
i think the devise code is just like that because when José Valim wrote these lines 13 years ago, mattr_accessor did not yet support passing a default value:
I think this may be an interesting change, I may need this for a use case where I want to alias |
My use case is the same as in the original issue: running rails in API mode. I've been using this fork and the setting |
fixes #618
for the interface, i mirrored
Devise::parent_controller=
.