Yes, this is the default behavior. When you post invalid data it renders
rather than redirects. One reason is this way you don't need to maintain
state across the redirect.
On Feb 5, 2017 3:01 PM, "Hassan Schroeder"
wrote:
> On Sat, Feb 4, 2017 at 1:18 PM, Denis K
On Sat, Feb 4, 2017 at 1:18 PM, Denis K wrote:
> 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
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" wrote:
> Hi,
>
> On Sun, Feb 5, 2017, at 06:18, Denis K wrote:
> > Hi,
> >
> > I'm new to
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
>
On 4 February 2017 at 21: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
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
6 matches
Mail list logo