开发者

rails 3 pass params into partial with haml and unobtrusive javascript

开发者 https://www.devze.com 2023-03-18 11:29 出处:网络
How to pass params into partial with haml and unobtrusive javascript comments/create.js.haml $(\"#comment_list\").html(\"#{escape_javascript( render(:partial => \"shared/comments\", :locals =>

How to pass params into partial with haml and unobtrusive javascript

comments/create.js.haml

$("#comment_list").html("#{escape_javascript( render(:partial => "shared/comments", :locals => { :commentable => @album }) ).html_safe}");

cra开发者_Go百科shed

but in albums/show.html.haml

#comment_list= render :partial => 'shared/comments', :locals => { :commentable => @album }

working without bugs


I'm change

#comment_list= render :partial => 'shared/comments', :locals => { :commentable => @album }

to

#comment_list= render :partial => 'shared/comments', :locals => { :commentable => @commentable }

and install Haml v3.1.2

0

精彩评论

暂无评论...
验证码 换一张
取 消