adding documentation for f.association

Example of how to use :label_method and :value_method with f.association

closes #662
This commit is contained in:
dinnouti 2012-09-17 13:32:32 -04:00 committed by Vasiliy Ermolovich
parent ce8e96d68a
commit ff5437d6f4
1 changed files with 6 additions and 0 deletions

View File

@ -318,6 +318,12 @@ the collection by hand, all together with the prompt:
f.association :company, :collection => Company.active.all(:order => 'name'), :prompt => "Choose a Company"
```
In case you want to declare different labels and values:
```ruby
f.association :company, :label_method => :company_name, :value_method => :id, :include_blank => false %>
```
### Buttons
All web forms need buttons, right? **SimpleForm** wraps them in the DSL, acting like a proxy: