Ruby on Rails Sunday, February 5, 2017

On Sat, Feb 4, 2017 at 1:18 PM, Denis K <> wrote:

> I've stuck in step 5.10:
> def create
> @article =
> if
> 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?


Note the difference between "redirect_to" which sends a redirect
response header and new URL to the user-agent vs. "render" which
stays at the same URL and provides the content of the "new" view.

Hassan Schroeder ------------------------
twitter: @hassan
Consulting Availability : Silicon Valley or remote

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
To post to this group, send email to
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment