Permalink
Browse files

Added support for original_content to prevent direct call to value me…

…thod
  • Loading branch information...
hab committed May 29, 2012
1 parent c3f676b commit c125f34a96e64b697fb221ed8592547727cc40db
Showing with 6 additions and 1 deletion.
  1. +1 −0 .gitignore
  2. +5 −1 lib/best_in_place/helper.rb
View
@@ -9,3 +9,4 @@ test_app/log/*.log
test_app/tmp/**/*
.rvmrc
+.idea/
@@ -44,7 +44,11 @@ def best_in_place(object, field, opts = {})
out << " data-type='#{opts[:type]}'"
out << " data-inner-class='#{opts[:inner_class]}'" if opts[:inner_class]
out << " data-html-attrs='#{opts[:html_attrs].to_json}'" unless opts[:html_attrs].blank?
- out << " data-original-content='#{attribute_escape(real_object.send(field))}'" if opts[:display_as] || opts[:display_with]
+ if opts[:original_content].present?
+ out << " data-original-content='#{opts[:original_content]}'"
+ else
+ out << " data-original-content='#{attribute_escape(real_object.send(field))}'" if (opts[:display_as] || opts[:display_with])
+ end
if opts[:data] && opts[:data].is_a?(Hash)
opts[:data].each do |k, v|
if !v.is_a?(String) && !v.is_a?(Symbol)

0 comments on commit c125f34

Please sign in to comment.