-
Notifications
You must be signed in to change notification settings - Fork 81
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
Respect attribute translations in #check_box #126
base: master
Are you sure you want to change the base?
Conversation
klass = object.class | ||
return method.to_s.humanize unless klass.respond_to?(:human_attribute_name) | ||
|
||
klass.human_attribute_name(method) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work @atipugin ! I'll look into this human_attribute_name
method a little (because I don't know it) before accepting.
Meanwhile, do you mind changing the syntax of this method? I don't like return … if …
statements.
You could just write the following instead:
def default_label_for(method)
if object.class.respond_to? :human_attribute_name
object.class.human_attribute_name method
else
method.to_s.humanize
end
end
Apart from that, I want to make check whether:
- "default" is a good name for this method
default_label_for
. What is your rationale behind this name? - the code will work if
human_attribute_name
is defined, but then no translation exists for the method
Thanks again, everything else looks good!!!
Could you also squish all your commits together? Thanks! 🎀 |
Changed code to if/else statement. Answering your questions:
|
Ping! 🌟 |
Solves this issue: https://github.com/Fullscreen/bh/issues/123