Commit ff03e98b152a7f66f090779a36b44f459671dd8d
1 parent
cd305024
Exists in
master
and in
1 other branch
SF update
Showing
1 changed file
with
4 additions
and
2 deletions
Show diff stats
vendor/plugins/semi_formal/lib/semi_formal.rb
... | ... | @@ -47,15 +47,17 @@ class SemiFormal < ActionView::Helpers::FormBuilder |
47 | 47 | # returns a drop-down with value of User#id, text of User#to_s |
48 | 48 | # includes blank |
49 | 49 | # |
50 | - def belongs_to(field, *args) | |
50 | + def belongs_to(association, *args) | |
51 | 51 | options = args.extract_options! |
52 | 52 | |
53 | - reflection = @object.class.reflect_on_association(field) | |
53 | + reflection = @object.class.reflect_on_association(association) | |
54 | 54 | collection = reflection.klass.all.collect {|each| [each.to_s, each.id] } |
55 | 55 | |
56 | 56 | options[:select] ||= {} |
57 | 57 | options[:select][:include_blank] = true |
58 | 58 | |
59 | + field = "#{association}_id" | |
60 | + | |
59 | 61 | "<div class=\"belongs_to\">" + |
60 | 62 | label(field, options[:label] || {}) + |
61 | 63 | select(field, collection, options[:select] || {}) + | ... | ... |