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

removing duplicate code in railties/lib/rails/generators/resource_helper... #13771

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 1 addition & 3 deletions railties/lib/rails/generators/resource_helpers.rb
Expand Up @@ -16,12 +16,10 @@ def self.included(base) #:nodoc:
def initialize(*args) #:nodoc:
super
if options[:model_name]
controller_name = name
self.name = options[:model_name]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name gets changed here, so we cannot move controller_name assignment below this line.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. It appears that what looked like a cosmetic change caused unexpected downstream issues...

assign_names!(self.name)
else
controller_name = name
end
controller_name = name

if name == name.pluralize && name.singularize != name.pluralize && !options[:force_plural]
unless ResourceHelpers.skip_warn
Expand Down