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

Update find_message to accept scope #3405

Merged
merged 2 commits into from
Jan 7, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/devise_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def devise_i18n_options(options)

# Get message for given
def find_message(kind, options = {})
options[:scope] = "devise.#{controller_name}"
options[:scope] = "devise.#{controller_name}" unless options[:scope]
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should use options[:scope] ||= then? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@josevalim you are right that is more elegant:)

I am always kind of scare in using the monad style (there are different opinion of what really ||= means, but in this case there is no possibility of been wrong):

I am going to change the pull request and resubmit:)

options[:default] = Array(options[:default]).unshift(kind.to_sym)
options[:resource_name] = resource_name
options = devise_i18n_options(options)
Expand Down