How to do I convert an rjs file to js.erb
Just renaming doesn't work in my case
This is my old code(works well with rails 2 app)
page.replace_html(
"overlay" ,
:partial => @path_resolver.resolve_template(
:tmpl_name => 'cmn/popup/shared/show_popup',
:partial => true
),
:object => @content_data
)
I changed the code to
page.replace_html(
"overlay" ,
("<%= escape_javascript(render(
:partial => @path_resolver.resolve_template(
:tmpl_name => 'cmn/popup/shared/show_popup',
:partial => true
))) %>"),
:locals => {:object => @content_data }
)
Now I got an syntax error in firebug like
SyntaxError: syntax error
:locals => {:object => @content_data }
If i pass the object code as :object => @content_data (without using locals)
im getting another error
syntax error
:object => @content_data
I found a solution.
We need to use
Element.update
in place ofpage.replace_html
.The new code looks like: