README.md in template_form-0.4.5 vs README.md in template_form-0.4.6
- old
+ new
@@ -157,9 +157,16 @@
errors: errors
).html_safe
end
```
+You also have access to the `view` in which the template is contained. This is handy if you need to call methods on the view inside your template. For example, translating values for data attributes.
+
+```erb
+<div data-controller="foo" data-foo-show-value=view.translate("foo.show")>
+</div>
+```
+
### Attribute types and form inputs
Template Form looks up the type for the attribute, falling back to `:string` if it can't find one. Then it uses the corresponding form input.
Attribute type | Form input