I
I
Ilnar252016-06-23 10:16:14
Ruby on Rails
Ilnar25, 2016-06-23 10:16:14

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!852c580ae63e4eb2805679d50ee70628.png3978e83748a44b2ca07a847d866feb79.pngc1d5f5a1d89d403088a447c94d60906b.png841ec8655bc041d1af17dc982a9c1c4f.png66bb08a5debe4590844ad46898999cf7.pngdb59b8d823874918bfea7b147551976e.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
N. Bekseitov, 2016-06-23
@Ilnar25

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 question

Ask a Question

731 491 924 answers to any question