ruby on rails - RoR routing error, No route matches [POST] -
I'm starting in Rail, this is a Rail Guide blog app, after submitting the form I Do not get [POST] "/ article / new" which is strange because as you can see from the routes given below, there is no post for article / new.
Controller file:
def new @article = Article.new end def can be created @article = article.new (article_params) if @ article.save redirect_to @article Else 'New Render' End and Def Show 'Artical = Article PAYMENT (: Title:, Text) and
Route file:
Code> Rails.application.routes.draw 'Welcome / index' root 'Welcome # index' Get the resource: article
route:
prefix verb Welcome to URI Pattern Controller # Action welcome_index GET /welcome/index(.format) # Index Root is Received / Welcome # Index Articles / Articles (. S # Index POST / Articles (. Content) Article # Create new_article / article / new (.: Format) article # New editing_article received / article / ed / edit (Format: Articles) Articles # Get Articles / Articles /: Id (.: Format) Article # Show patch / article / show. / .id (.: Format) Article # Update PUT / Author / :( (. Format) Articles # Delete the update / article / id (. #destroy
[edit] Here The form is also
& lt;% = form_for: article, url: articles_path do | f | & gt;; & lt; p & gt; & lt;% = f.label: title % & Gt; & lt; br & gt; & lt;% = f.text_field: Title% & gt; & lt; / p & gt; & lt; p & gt; & lt;% = f.label: Text % & Gt; & lt; br & gt; & lt;% = f.text_area: Text% & gt; & lt; / p & gt; & lt; p & gt; & lt;% = f.submit% & Gt; & lt; / p & gt; & lt;% end% & gt;
< P> Change Form Assistant to:
& lt;% = Write @for form_ | F |% & Gt;
The URL does not need to be specified if it is the default controller action (make the article #)
Other options:
& Lt;% = & Gt% for the article;
Comments
Post a Comment