heartcombo / simple_form

Forms made easy for Rails! It's tied to a simple DSL, with no opinion on markup.
http://blog.plataformatec.com.br/tag/simple_form
MIT License
8.21k stars 1.31k forks source link

Pass base object to `human_attribute_name` for labels #1812

Closed motine closed 2 months ago

motine commented 1 year ago

When discovering translations, Rails passes the base object to human_attribute_name. This is helpful because human_attribute_name is a class method and does not have access to instance methods. If someone wants to customize the behavior of said method based on properties of the instance, this is not possible without this argument. This merge request makes a tiny change to pass this base object.

nashby commented 2 months ago

@motine thanks, that's useful indeed!