开发者

Rails - CanCan - If can? works on page load but not via a AJAX Partial

Hello I have the following in a partial.

<% if can? :update, @permission %>
Yes
<% end %>

For the exact same user, when this loads via html this works great. But when I render that partial via ajax, as so:

$('#current').html('<%=escape_javascript(render :partial =>"permissions/teammembers", :locals => {:teammembers => @teammembers}) %>');

Then cancan is return false, why is that? the current_user is开发者_JAVA百科 the same person making the request?

Thanks


Check if @permission is not nil. Throw it and see if it is ok.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜