Take a look at your article.rb file.  You have validations in it that
prevent you from writing data to your table (unless you meet those
conditions).




On Feb 5, 2017 4:34 AM, "nanaya" <[email protected]> wrote:

> Hi,
>
> On Sun, Feb 5, 2017, at 06:18, Denis K wrote:
> > Hi,
> >
> > I'm new to Rails and going through "Getting Started with Rails"
> >
> > I've stuck in step 5.10:
> > def create
> >   @article = Article.new(article_params)
> >   if @article.save
> >     redirect_to @article
> >   else
> >     render 'new'
> >   end
> > end
> >
> > As I understand posting new article with invalid title should invoke else
> > statement and render [/new] with error message
> >
> > It shows error but throws to [http://localhost:3000/articles], instead
> of
> > [http://localhost:3000/articles*/new*]
> >
> > Is it how it supposed to work?
> > Or what am I doing wrong?
> >
>
> it renders 'new' but the current route is `post /articles` (no redirect)
> so it is correct.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/rubyonrails-talk/1486287271.3697408.870741768.77CD3048%40webmail.
> messagingengine.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMmZ2dcBtOUeXAecxpi1Q2K-xdkp6M%2BgNR_J%3Do%2BUSOVBTw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to