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

still display_with (or display_as) is not applying after ajax success :'( #503

Open okliv opened 9 years ago

okliv commented 9 years ago
<%= best_in_place_if current_admin_user.present?, resource, :text, :as => :textarea, 
        display_as: :m_text, #redcarpet render model method correctly applies only at initial page render
        inner_class: 'markdowned', html_attrs: {:'data-provide'=> 'markdown'}
%>

all i found is ugly

$(function(){
   $(".best_in_place").best_in_place().bind("ajax:success", function(){
       location.reload();
   });
});

rails 4.1.8 best_in_place 3.0.3

vanboom commented 8 years ago

I was having the same issue, and was able to fix it by adding this to the controller...

def update
  ...
  respond_to do |format|
     ...
     format.json { respond_with_bip @user }
  end
end
petitJAM commented 8 years ago

I'm seeing the same problem after an ajax:error. Any ajax:success after an ajax:error doesn't apply the display_with lambda. Haven't tried it with display_as.

This is on Rails 4.2.5.1 and BIP 3.1.0

seuros commented 8 years ago

display_* is not thread safe.

JoelBeasley commented 8 years ago

@seuros are there plans to make display_* thread safe?

Update: Clearly I don't understand thread safe because this feature works on my production server just not development.