Browse files

Made my change a little cleaner

  • Loading branch information...
1 parent 0d1094a commit f729a5d206dfb1a17c2a984853e9ddf0173d45a9 @pjungwir committed Mar 14, 2012
Showing with 2 additions and 5 deletions.
  1. +2 −5 lib/best_in_place/helper.rb
View
7 lib/best_in_place/helper.rb
@@ -19,11 +19,8 @@ def best_in_place(object, field, opts = {})
collection = nil
if opts[:type] == :select && !opts[:collection].blank?
v = object.send(field)
- if v.nil?
- value = Hash[opts[:collection]]['']
- else
- value = Hash[opts[:collection]][!!(v =~ /^[0-9]+$/) ? v.to_i : v]
- end
+ v = '' if v.nil?
+ value = Hash[opts[:collection]][!!(v =~ /^[0-9]+$/) ? v.to_i : v]
collection = opts[:collection].to_json
end
if opts[:type] == :checkbox

0 comments on commit f729a5d

Please sign in to comment.