ruby on rails - undefined method `article_path' -
this error occuring , have no idea why, thanks, undefined method `article_path' #<#:0x000001029cb960>
edit.html.erb
<h1>editing <%= @article.name %></h1> <%= form_for(@article) |f| %> <-- ????something here? <p> <%= f.label :name %><br /> <%= f.text_field :name %> </p> <p> <%= f.submit %> </p> <% end %> articles model
class mediacontroller < applicationcontroller def index @articles = articles.all end def show @article = articles.find(params[:id]) end def edit @article = articles.find(params[:id]) end def update @article.find(params[:id]) article_params = params.require(:article).permit(:name, :description, :location) @article.update(article_params) redirect_to @article end end routes.rb
resources :media patch "events/:id" => "media#update", as: "update_medium"
change routes
patch "articles/:id" => "media#update", as: "update_medium" and model name singular :
@articles = article.all
Comments
Post a Comment