-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Updating default settings of ApplicationController.renderer is not working #22975
Comments
Hmm. It seems undesirable that you'd be changing the defaults for all renderers, rather than just those for controllers inherited from ApplicationController. But it's also not very useful to configure only ApplicationController's renderer, and miss those for its subclasses. 😕 |
@matthewd I agree. I think this is just an example to show how the defaults can be customized. But it does not work because of the frozen hash. Should we use |
@prathamesh-sonpatki + @matthewd: Is this something I should create a pull request for? I ran into this too and it seems a little odd that a generated file's commented code doesn't work if you try to use it |
A few notes for visual clarity (those involved probably already know firsthand)
Example:
Result on 'rails s'
I'd be happy to help, but viewing the above comments, it's not clear what direction is the best. If anyone needs me to write some comments, let me know. |
Putting this on the 5.0.0 milestone, since this initializer (and the current issue) was first added in the 5.0 betas. |
Previously, users were trying to modify a frozen Hash. Includes a regression test :) Fixes rails#22975
Opened #24661 to |
We generate an initializer
application_controller_renderer
to allow users to update the default config options for rendering templates outside of controller with following content.But the
ApplicationController.renderer.defaults
hash is frozen - https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/renderer.rb#L45. So it raises an error if we try to modify it.The text was updated successfully, but these errors were encountered: