Answer the question
In order to leave comments, you need to log in
Error (NoMethodError in PostsController#create) when checking for tags in posts?
I can't check for the presence of tags in the params data, please tell me my mistake.... Thank you!
Answer the question
In order to leave comments, you need to log in
Change the condition in create to if params[:tag].try(:name). And it’s better to remove the condition, since you already have validation in the model
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question