From 504ba12e8cd256b08a43f8ee56c6e2b0272ce6cc Mon Sep 17 00:00:00 2001 From: Oscar Del Ben Date: Sat, 21 Apr 2012 12:01:33 +0200 Subject: Add model validation section to Getting Started guide --- .../app/assets/javascripts/comments.js.coffee | 3 -- .../app/assets/javascripts/home.js.coffee | 3 -- .../app/assets/javascripts/posts.js.coffee | 3 -- .../app/assets/stylesheets/comments.css.scss | 3 -- .../app/assets/stylesheets/home.css.scss | 3 -- .../app/assets/stylesheets/posts.css.scss | 3 -- .../app/assets/stylesheets/scaffolds.css.scss | 56 ---------------------- .../app/controllers/posts_controller.rb | 7 ++- .../vendor/assets/stylesheets/.gitkeep | 0 9 files changed, 5 insertions(+), 76 deletions(-) delete mode 100644 guides/code/getting_started/app/assets/javascripts/comments.js.coffee delete mode 100644 guides/code/getting_started/app/assets/javascripts/home.js.coffee delete mode 100644 guides/code/getting_started/app/assets/javascripts/posts.js.coffee delete mode 100644 guides/code/getting_started/app/assets/stylesheets/comments.css.scss delete mode 100644 guides/code/getting_started/app/assets/stylesheets/home.css.scss delete mode 100644 guides/code/getting_started/app/assets/stylesheets/posts.css.scss delete mode 100644 guides/code/getting_started/app/assets/stylesheets/scaffolds.css.scss delete mode 100644 guides/code/getting_started/vendor/assets/stylesheets/.gitkeep (limited to 'guides/code') diff --git a/guides/code/getting_started/app/assets/javascripts/comments.js.coffee b/guides/code/getting_started/app/assets/javascripts/comments.js.coffee deleted file mode 100644 index 761567942f..0000000000 --- a/guides/code/getting_started/app/assets/javascripts/comments.js.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/guides/code/getting_started/app/assets/javascripts/home.js.coffee b/guides/code/getting_started/app/assets/javascripts/home.js.coffee deleted file mode 100644 index 761567942f..0000000000 --- a/guides/code/getting_started/app/assets/javascripts/home.js.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/guides/code/getting_started/app/assets/javascripts/posts.js.coffee b/guides/code/getting_started/app/assets/javascripts/posts.js.coffee deleted file mode 100644 index 761567942f..0000000000 --- a/guides/code/getting_started/app/assets/javascripts/posts.js.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/guides/code/getting_started/app/assets/stylesheets/comments.css.scss b/guides/code/getting_started/app/assets/stylesheets/comments.css.scss deleted file mode 100644 index e730912783..0000000000 --- a/guides/code/getting_started/app/assets/stylesheets/comments.css.scss +++ /dev/null @@ -1,3 +0,0 @@ -// Place all the styles related to the Comments controller here. -// They will automatically be included in application.css. -// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/guides/code/getting_started/app/assets/stylesheets/home.css.scss b/guides/code/getting_started/app/assets/stylesheets/home.css.scss deleted file mode 100644 index f0ddc6846a..0000000000 --- a/guides/code/getting_started/app/assets/stylesheets/home.css.scss +++ /dev/null @@ -1,3 +0,0 @@ -// Place all the styles related to the home controller here. -// They will automatically be included in application.css. -// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/guides/code/getting_started/app/assets/stylesheets/posts.css.scss b/guides/code/getting_started/app/assets/stylesheets/posts.css.scss deleted file mode 100644 index ed4dfd10f2..0000000000 --- a/guides/code/getting_started/app/assets/stylesheets/posts.css.scss +++ /dev/null @@ -1,3 +0,0 @@ -// Place all the styles related to the Posts controller here. -// They will automatically be included in application.css. -// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/guides/code/getting_started/app/assets/stylesheets/scaffolds.css.scss b/guides/code/getting_started/app/assets/stylesheets/scaffolds.css.scss deleted file mode 100644 index 05188f08ed..0000000000 --- a/guides/code/getting_started/app/assets/stylesheets/scaffolds.css.scss +++ /dev/null @@ -1,56 +0,0 @@ -body { - background-color: #fff; - color: #333; - font-family: verdana, arial, helvetica, sans-serif; - font-size: 13px; - line-height: 18px; } - -p, ol, ul, td { - font-family: verdana, arial, helvetica, sans-serif; - font-size: 13px; - line-height: 18px; } - -pre { - background-color: #eee; - padding: 10px; - font-size: 11px; } - -a { - color: #000; - &:visited { - color: #666; } - &:hover { - color: #fff; - background-color: #000; } } - -div { - &.field, &.actions { - margin-bottom: 10px; } } - -#notice { - color: green; } - -.field_with_errors { - padding: 2px; - background-color: red; - display: table; } - -#error_explanation { - width: 450px; - border: 2px solid red; - padding: 7px; - padding-bottom: 0; - margin-bottom: 20px; - background-color: #f0f0f0; - h2 { - text-align: left; - font-weight: bold; - padding: 5px 5px 5px 15px; - font-size: 12px; - margin: -7px; - margin-bottom: 0px; - background-color: #c00; - color: #fff; } - ul li { - font-size: 12px; - list-style: square; } } diff --git a/guides/code/getting_started/app/controllers/posts_controller.rb b/guides/code/getting_started/app/controllers/posts_controller.rb index e4d83dd279..2ad69a9bcf 100644 --- a/guides/code/getting_started/app/controllers/posts_controller.rb +++ b/guides/code/getting_started/app/controllers/posts_controller.rb @@ -14,7 +14,10 @@ class PostsController < ApplicationController def create @post = Post.new(params[:post]) - @post.save - redirect_to :action => :show, :id => @post.id + if @post.save + redirect_to :action => :show, :id => @post.id + else + render 'new' + end end end diff --git a/guides/code/getting_started/vendor/assets/stylesheets/.gitkeep b/guides/code/getting_started/vendor/assets/stylesheets/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 -- cgit v1.2.3