Re: [Rails] Going through /getting_started.html — stuck on step 5.10 "Validation" and "render 'new'"

2017-02-05 Thread Scott Jacobsen
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

Re: [Rails] Going through /getting_started.html — stuck on step 5.10 "Validation" and "render 'new'"

2017-02-05 Thread Hassan Schroeder
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

Re: [Rails] Going through /getting_started.html — stuck on step 5.10 "Validation" and "render 'new'"

2017-02-05 Thread Joe Guerra
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

Re: [Rails] Going through /getting_started.html — stuck on step 5.10 "Validation" and "render 'new'"

2017-02-05 Thread nanaya
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 >

Re: [Rails] Going through /getting_started.html — stuck on step 5.10 "Validation" and "render 'new'"

2017-02-05 Thread Colin Law
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

[Rails] Going through /getting_started.html — stuck on step 5.10 "Validation" and "render 'new'"

2017-02-05 Thread Denis K
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