I want to use link_to to create a new article and set the article’s name.
This is what I’ve tried:
<%= link_to 'Create A New Article called Edward', articles_path, :name =>'Edward', :method => :post %>
It creates a new article, but it is blank.
<%= link_to 'Create A New Article called Edward', articles_path(:name =>'Edward') , :method => :post %>
does exactly the same.
Thanks for any help.
It looks like you need to nest it in an
:articleshash since your controller is likely trying to accessparams[:article]to get the values (you would think that by putting it within thearticles_path(...)part this would happen automatically, but it doesn’t).