ruby on rails - Url changes when rendering view -


i'm following ruby getting started guide, section 5.10 asks add code check if data added model valid, if isn't should call render 'new' refresh page users data:

def create @article = article.new(article_params)   if @article.save     redirect_to @article   else     render 'new'   end end 

i've noticed though moment submit wrong data url changes :

http://localhost:3000/articles/new http://localhost:3000/articles, why that? rendering seems work since error messages indicating invalid input in tutorial.

the html output looks off too, there's space between 1 of labels , text input field.

url change because it's put http method, ror use rest crud actions, "in rails, resourceful route provides mapping between http verbs , urls controller actions. convention, each action maps particular crud operations in database."


Comments