Commit cd305024f6aab45ea47efa5dfa6e13a150493524
1 parent
d89eda92
Exists in
master
and in
1 other branch
updated semi formal with working belongs_to field
Showing
1 changed file
with
6 additions
and
2 deletions
Show diff stats
vendor/plugins/semi_formal/lib/semi_formal.rb
| ... | ... | @@ -42,6 +42,11 @@ class SemiFormal < ActionView::Helpers::FormBuilder |
| 42 | 42 | "<div>" |
| 43 | 43 | end |
| 44 | 44 | |
| 45 | + # form.belongs_to :user | |
| 46 | + # | |
| 47 | + # returns a drop-down with value of User#id, text of User#to_s | |
| 48 | + # includes blank | |
| 49 | + # | |
| 45 | 50 | def belongs_to(field, *args) |
| 46 | 51 | options = args.extract_options! |
| 47 | 52 | |
| ... | ... | @@ -53,7 +58,7 @@ class SemiFormal < ActionView::Helpers::FormBuilder |
| 53 | 58 | |
| 54 | 59 | "<div class=\"belongs_to\">" + |
| 55 | 60 | label(field, options[:label] || {}) + |
| 56 | - select(field, collection, options[:select] || {}) | |
| 61 | + select(field, collection, options[:select] || {}) + | |
| 57 | 62 | "<div>" |
| 58 | 63 | end |
| 59 | 64 | |
| ... | ... | @@ -62,7 +67,6 @@ class SemiFormal < ActionView::Helpers::FormBuilder |
| 62 | 67 | # html_options[:multiple] ||= true |
| 63 | 68 | # html_options[:size] ||= 5 |
| 64 | 69 | # end |
| 65 | - | |
| 66 | 70 | end |
| 67 | 71 | |
| 68 | 72 | ActionView::Base.default_form_builder = SemiFormal | ... | ... |