Skip to content
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

Rename GoodJob::BaseController to GoodJob::ApplicationController #553

Merged

Conversation

shouichi
Copy link
Contributor

@shouichi shouichi commented Apr 5, 2022

Problem:

When config.action_controller.include_all_helpers = false, helpers are
not available by default which leads to undefined method 'relative_time'.
This is because the controller is named BaseController and the helper
is named ApplicationHelper.

https://api.rubyonrails.org/classes/ActionController/Helpers.html.
In previous versions of Rails the controller will include a helper
which matches the name of the controller, e.g., MyController will
automatically include MyHelper.

Solution:

Rename BaseController to ApplicationController. By following the
rails naming convention, necessary helpers are automatically included by
rails.

Close #550.

@bensheldon bensheldon changed the title Follow the rails naming convention Rename GoodJob::BaseController to GoodJob::ApplicationController Apr 5, 2022
shouichi and others added 3 commits April 5, 2022 08:43
Problem:

When `config.action_controller.include_all_helpers = false`, helpers are
not available by default which leads to `undefined method 'relative_time'`.
This is because the controller is named `BaseController` and the helper
is named `ApplicationHelper`.

> https://api.rubyonrails.org/classes/ActionController/Helpers.html.
> In previous versions of Rails the controller will include a helper
> which matches the name of the controller, e.g., MyController will
> automatically include MyHelper.

Solution:

Rename `BaseController` to `ApplicationController`. By following the
rails naming convention, necessary helpers are automatically included by
rails.
@bensheldon bensheldon force-pushed the rename-to-application-controller branch from 9069162 to e5fcf91 Compare April 5, 2022 15:44
@bensheldon bensheldon merged commit af4aa5b into bensheldon:main Apr 5, 2022
@shouichi shouichi deleted the rename-to-application-controller branch April 6, 2022 00:28
@shouichi
Copy link
Contributor Author

shouichi commented Apr 6, 2022

@bensheldon thanks for the follow-up commits!

@bensheldon bensheldon added the refactor Code changes that do not introduce new features label Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Code changes that do not introduce new features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

undefined method `relative_time' when include_all_helpers is false
2 participants