Browse files

Add a default :prompt option

  • Loading branch information...
1 parent e7de474 commit 31111adb89a1d57c9d27d348bff7c1ca4ba12cea @jseibert committed Oct 2, 2011
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/best_in_place/helper.rb
View
3 lib/best_in_place/helper.rb
@@ -3,8 +3,9 @@ module BestInPlaceHelpers
def best_in_place(object, field, opts = {})
opts[:type] ||= :input
opts[:collection] ||= []
+ opts[:prompt] ||= ""
field = field.to_s
- value = object.send(field).blank? ? "" : object.send(field)
+ value = object.send(field).blank? ? opts[:prompt] : object.send(field)
collection = nil
if opts[:type] == :select && !opts[:collection].blank?
v = object.send(field)

0 comments on commit 31111ad

Please sign in to comment.