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

Conversation

Dinuz
Copy link
Contributor

@Dinuz Dinuz commented Jan 7, 2015

This should still keep the devise lookup in the case that a customed scope is not passed as option, but if instead the custom scope is passed, then the find_message method will use it.

This is kind of useful, if i don't want overwrite the devise locale, and use different locale files, but keeping still the fallback of my devise locale.

This should still keep the devise lookup in the case that a customed scope is not passed as option, but if instead the custom scope is passed, then the find_message method will use it.

This is kind of useful, if i don't want overwrite the devise locale, and use different locale files, but keeping still the fallback of my devise locale.
@@ -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:)

josevalim added a commit that referenced this pull request Jan 7, 2015
Update find_message to accept scope
@josevalim josevalim merged commit 710efe5 into heartcombo:master Jan 7, 2015
@josevalim
Copy link
Contributor

❤️ 💚 💙 💛 💜

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants