I am working in Rail 4 and have received Cancun to work well with the instructions, Em> except for a use case which I think may be relatively common.
I have a I have allowed this feature through strong standards: Because I can create an association if any But once i The solution to my sleep came to me to solve this problem: What I did: / P> There was no problem generating the only reason I hope it helps someone else who makes such a mistake! comment model, which is
is_im: comments, via :: for nested comments. All this is working fine, as long as I add
load_and_authorize_resource to my comment controller, I think this attribute can be replaced by an optional
: parent_comment_id attribute via strong parameters There may be a problem with the hidden field to send.
def comment on the top (note.). Pyremit (: content, parent_comment_id,: post_id, : Comment_id, user_id) end
: parent_comment_id is included:
if Comment_params [: parent_comment_id]! Answer = Nil. ({: Parent_comment_id = & gt; Comment_user [: parent_comment_id] ,: comment_id = & gt; @ comment.id}) end
load_and_authorize_resource Add, then I get an unknown attribute error for
: parent_comment_id . What am I missing?
comment_params because I was leaving the extra
: parent_comment_id parameter, like this: <
comment_params Although the method was not such a cleanliness, therefore, problem On the basis of per-controller, Cancans would have been messy to add hygiene, so I did what I should have done together and instead of going inside
: parent_comment_id ,
: comment < / Code>, I used
hidden_field_tag to pass it out to
: comment and through plain, old
parameters Accessed.
No comments:
Post a Comment