ruby - generated Set_model path in rails controller -
i'm used scaffold_controller generate controller model have. in view, have following link to
link_to, 'like', like_path(param: 'param')
in controller generated, have private method set_like called , can figure out why. want link go likes#new path, it's going set_like method first. feel new rails thing , i'm not sure why. ideas?
looks want use "new_like_path" rather "like_path".
you benefit reading closely: http://guides.rubyonrails.org/routing.html
when use "like_path" linking existing record, id should pass "like_path" route generator. like:
like_path(2) # link id==2
Comments
Post a Comment