Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Made my change a little cleaner

  • Loading branch information...
commit f729a5d206dfb1a17c2a984853e9ddf0173d45a9 1 parent 0d1094a
Paul A Jungwirth authored

Showing 1 changed file with 2 additions and 5 deletions. Show diff stats Hide diff stats

  1. +2 5 lib/best_in_place/helper.rb
7 lib/best_in_place/helper.rb
@@ -19,11 +19,8 @@ def best_in_place(object, field, opts = {})
19 19 collection = nil
20 20 if opts[:type] == :select && !opts[:collection].blank?
21 21 v = object.send(field)
22   - if v.nil?
23   - value = Hash[opts[:collection]]['']
24   - else
25   - value = Hash[opts[:collection]][!!(v =~ /^[0-9]+$/) ? v.to_i : v]
26   - end
  22 + v = '' if v.nil?
  23 + value = Hash[opts[:collection]][!!(v =~ /^[0-9]+$/) ? v.to_i : v]
27 24 collection = opts[:collection].to_json
28 25 end
29 26 if opts[:type] == :checkbox

0 comments on commit f729a5d

Please sign in to comment.
Something went wrong with that request. Please try again.