I have a rails 2.3.9 application that i'm migrating to rails 3.
As almost everyone, i'm having problem with rendering strings, specially JQUERY scripts that were inline. Before, that somebody tells me that in rails 3, it changed, i cannot rewrite all my scripts now. I will do it, it will be scheduled, but for now, i want to make it works.
Going to my question:
i have a controller with the following piece of code
respond_to do |format|
format.js { render :partial=>'update'}
format.html { head 406 }
end
My _update.js.erb has a mix between JS and ERB:
<% if MyClass.count > 0 %>
$('.show_object:visible').hide();
<%else%>
if($('.show_object').css('display') == 'none'){
$('.show_object').blink({times: 7})
}
<%end%>
It works in rails 2.3.9, but not in Rails 3. My question are:
- should i put around all my jquery a html_safe call?
- there is a way in the controller to mark a whole partial as html_safe?