bernat / best_in_place

A RESTful unobtrusive jQuery Inplace-Editor and a helper as a Rails Gem
http://blog.bernatfarrero.com/in-place-editing-with-javascript-jquery-and-rails-3/
1.2k stars 571 forks source link

collection prototype is inconsistent with rails / simple_form #541

Open itkin opened 8 years ago

itkin commented 8 years ago

Hello,

:collection option expects a [value, label] array whereas simple_form (and rails options_for_select helper) expect [label, value]

Pretty disturbing, may we change line 25 of helper.rb ? I propose to remove it since it overrides display_with/display_as options

display_value = collection.flat_map{|a| a[0].to_s == value ? a[1] : nil }.compact[0]
#for 
display_value = collection.flat_map{|a| a[1].to_s == value ? a[0] : nil }.compact[0]

Thanks for your great gem !