From 7438e2fa83b7a9185f4814ddd0f7eab2183c142d Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Tue, 25 Jun 2013 19:06:15 -0300 Subject: Fix another "error_explanation" css class in guides [ci skip] --- guides/code/getting_started/app/views/posts/_form.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'guides/code/getting_started') diff --git a/guides/code/getting_started/app/views/posts/_form.html.erb b/guides/code/getting_started/app/views/posts/_form.html.erb index c9fb74af9c..f2f83585e1 100644 --- a/guides/code/getting_started/app/views/posts/_form.html.erb +++ b/guides/code/getting_started/app/views/posts/_form.html.erb @@ -1,6 +1,6 @@ <%= form_for @post do |f| %> <% if @post.errors.any? %> -
+

<%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:

    @@ -14,12 +14,12 @@ <%= f.label :title %>
    <%= f.text_field :title %>

    - +

    <%= f.label :text %>
    <%= f.text_area :text %>

    - +

    <%= f.submit %>

    -- cgit v1.2.3 From b22cbf826763098bec6206f59f17d92c40b58f0a Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Fri, 28 Jun 2013 00:43:02 +0900 Subject: Fix punctuation in config templates --- guides/code/getting_started/config/environments/development.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/code/getting_started') diff --git a/guides/code/getting_started/config/environments/development.rb b/guides/code/getting_started/config/environments/development.rb index d169e9452c..7e5692b08b 100644 --- a/guides/code/getting_started/config/environments/development.rb +++ b/guides/code/getting_started/config/environments/development.rb @@ -22,7 +22,7 @@ Blog::Application.configure do # Only use best-standards-support built into browsers. config.action_dispatch.best_standards_support = :builtin - # Raise an error on page load if there are pending migrations + # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load # Debug mode disables concatenation and preprocessing of assets. -- cgit v1.2.3 From 53f12b073cc238757431708e6730e60b10b4d5fe Mon Sep 17 00:00:00 2001 From: Ankit Gupta Date: Sun, 7 Jul 2013 13:43:24 +0100 Subject: Refactored strong paramters usage and updated Gemfile.lock with Rails 4 --- guides/code/getting_started/Gemfile.lock | 182 +++++++++------------ .../app/controllers/comments_controller.rb | 8 +- .../app/controllers/posts_controller.rb | 10 +- .../app/views/welcome/index.html.erb | 1 + 4 files changed, 92 insertions(+), 109 deletions(-) (limited to 'guides/code/getting_started') diff --git a/guides/code/getting_started/Gemfile.lock b/guides/code/getting_started/Gemfile.lock index 888a6b30e2..2d5c50ef5c 100644 --- a/guides/code/getting_started/Gemfile.lock +++ b/guides/code/getting_started/Gemfile.lock @@ -1,135 +1,107 @@ -GIT - remote: git://github.com/rails/activerecord-deprecated_finders.git - revision: 2e7b35d7948cefb2bba96438873d7f7bb1961a03 - specs: - activerecord-deprecated_finders (0.0.2) - -GIT - remote: git://github.com/rails/arel.git - revision: 38d0a222e275d917a2c1d093b24457bafb600a00 - specs: - arel (3.0.2.20120819075748) - -GIT - remote: git://github.com/rails/coffee-rails.git - revision: 052634e6d02d4800d7b021201cc8d5829775b3cd - specs: - coffee-rails (4.0.0.beta) - coffee-script (>= 2.2.0) - railties (>= 4.0.0.beta, < 5.0) - -GIT - remote: git://github.com/rails/sass-rails.git - revision: ae8138a89cac397c0df903dd533e2862902ce8f5 - specs: - sass-rails (4.0.0.beta) - railties (>= 4.0.0.beta, < 5.0) - sass (>= 3.1.10) - sprockets-rails (~> 2.0.0.rc0) - tilt (~> 1.3) - -GIT - remote: git://github.com/rails/sprockets-rails.git - revision: 09917104fdb42245fe369612a7b0e3d77e1ba763 - specs: - sprockets-rails (2.0.0.rc1) - actionpack (>= 3.0) - activesupport (>= 3.0) - sprockets (~> 2.8) - -PATH - remote: /Users/steve/src/rails +GEM + remote: https://rubygems.org/ specs: - actionmailer (4.0.0.beta) - actionpack (= 4.0.0.beta) + actionmailer (4.0.0) + actionpack (= 4.0.0) mail (~> 2.5.3) - actionpack (4.0.0.beta) - activesupport (= 4.0.0.beta) + actionpack (4.0.0) + activesupport (= 4.0.0) builder (~> 3.1.0) erubis (~> 2.7.0) - rack (~> 1.4.3) - rack-test (~> 0.6.1) - activemodel (4.0.0.beta) - activesupport (= 4.0.0.beta) + rack (~> 1.5.2) + rack-test (~> 0.6.2) + activemodel (4.0.0) + activesupport (= 4.0.0) builder (~> 3.1.0) - activerecord (4.0.0.beta) - activemodel (= 4.0.0.beta) - activerecord-deprecated_finders (= 0.0.2) - activesupport (= 4.0.0.beta) - arel (~> 3.0.2) - activesupport (4.0.0.beta) - i18n (~> 0.6) - minitest (~> 4.1) + activerecord (4.0.0) + activemodel (= 4.0.0) + activerecord-deprecated_finders (~> 1.0.2) + activesupport (= 4.0.0) + arel (~> 4.0.0) + activerecord-deprecated_finders (1.0.3) + activesupport (4.0.0) + i18n (~> 0.6, >= 0.6.4) + minitest (~> 4.2) multi_json (~> 1.3) thread_safe (~> 0.1) - tzinfo (~> 0.3.33) - rails (4.0.0.beta) - actionmailer (= 4.0.0.beta) - actionpack (= 4.0.0.beta) - activerecord (= 4.0.0.beta) - activesupport (= 4.0.0.beta) - bundler (>= 1.2.2, < 2.0) - railties (= 4.0.0.beta) - sprockets-rails (~> 2.0.0.rc1) - railties (4.0.0.beta) - actionpack (= 4.0.0.beta) - activesupport (= 4.0.0.beta) - rake (>= 0.8.7) - rdoc (~> 3.4) - thor (>= 0.15.4, < 2.0) - -GEM - remote: https://rubygems.org/ - specs: - atomic (1.0.1) + tzinfo (~> 0.3.37) + arel (4.0.0) + atomic (1.1.10) builder (3.1.4) + coffee-rails (4.0.0) + coffee-script (>= 2.2.0) + railties (>= 4.0.0.beta, < 5.0) coffee-script (2.2.0) coffee-script-source execjs - coffee-script-source (1.4.0) + coffee-script-source (1.6.3) erubis (2.7.0) execjs (1.4.0) multi_json (~> 1.0) - hike (1.2.1) - i18n (0.6.1) - jbuilder (1.3.0) + hike (1.2.3) + i18n (0.6.4) + jbuilder (1.4.2) activesupport (>= 3.0.0) - jquery-rails (2.2.0) + multi_json (>= 1.2.0) + jquery-rails (3.0.2) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) - json (1.7.6) - mail (2.5.3) - i18n (>= 0.4.0) + json (1.8.0) + mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) - mime-types (1.19) - minitest (4.4.0) - multi_json (1.5.0) + mime-types (1.23) + minitest (4.7.5) + multi_json (1.7.7) polyglot (0.3.3) - rack (1.4.4) + rack (1.5.2) rack-test (0.6.2) rack (>= 1.0) - rake (10.0.3) - rdoc (3.12) + rails (4.0.0) + actionmailer (= 4.0.0) + actionpack (= 4.0.0) + activerecord (= 4.0.0) + activesupport (= 4.0.0) + bundler (>= 1.3.0, < 2.0) + railties (= 4.0.0) + sprockets-rails (~> 2.0.0) + railties (4.0.0) + actionpack (= 4.0.0) + activesupport (= 4.0.0) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (10.1.0) + rdoc (3.12.2) json (~> 1.4) - sass (3.2.5) - sprockets (2.8.2) + sass (3.2.9) + sass-rails (4.0.0) + railties (>= 4.0.0.beta, < 5.0) + sass (>= 3.1.10) + sprockets-rails (~> 2.0.0) + sdoc (0.3.20) + json (>= 1.1.3) + rdoc (~> 3.10) + sprockets (2.10.0) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) + sprockets-rails (2.0.0) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (~> 2.8) sqlite3 (1.3.7) - thor (0.16.0) + thor (0.18.1) thread_safe (0.1.0) atomic - tilt (1.3.3) - treetop (1.4.12) + tilt (1.4.1) + treetop (1.4.14) polyglot polyglot (>= 0.3.1) - turbolinks (1.0.0) + turbolinks (1.2.0) coffee-rails - tzinfo (0.3.35) - uglifier (1.3.0) + tzinfo (0.3.37) + uglifier (2.1.1) execjs (>= 0.3.0) multi_json (~> 1.0, >= 1.0.2) @@ -137,14 +109,12 @@ PLATFORMS ruby DEPENDENCIES - activerecord-deprecated_finders! - arel! - coffee-rails! - jbuilder (~> 1.0.1) + coffee-rails + jbuilder (~> 1.2) jquery-rails - rails! - sass-rails! - sprockets-rails! + rails (= 4.0.0) + sass-rails + sdoc sqlite3 turbolinks uglifier (>= 1.0.3) diff --git a/guides/code/getting_started/app/controllers/comments_controller.rb b/guides/code/getting_started/app/controllers/comments_controller.rb index 0e3d2a6dde..b2d9bcdf7f 100644 --- a/guides/code/getting_started/app/controllers/comments_controller.rb +++ b/guides/code/getting_started/app/controllers/comments_controller.rb @@ -4,7 +4,7 @@ class CommentsController < ApplicationController def create @post = Post.find(params[:post_id]) - @comment = @post.comments.create(params[:comment].permit(:commenter, :body)) + @comment = @post.comments.create(comment_params) redirect_to post_path(@post) end @@ -14,4 +14,10 @@ class CommentsController < ApplicationController @comment.destroy redirect_to post_path(@post) end + + private + + def comment_params + params.require(:comment).permit(:commenter, :body) + end end diff --git a/guides/code/getting_started/app/controllers/posts_controller.rb b/guides/code/getting_started/app/controllers/posts_controller.rb index 6aa1409170..02689ad67b 100644 --- a/guides/code/getting_started/app/controllers/posts_controller.rb +++ b/guides/code/getting_started/app/controllers/posts_controller.rb @@ -17,7 +17,7 @@ class PostsController < ApplicationController def update @post = Post.find(params[:id]) - if @post.update(params[:post].permit(:title, :text)) + if @post.update(post_params) redirect_to action: :show, id: @post.id else render 'edit' @@ -29,7 +29,7 @@ class PostsController < ApplicationController end def create - @post = Post.new(params[:post].permit(:title, :text)) + @post = Post.new(post_params) if @post.save redirect_to action: :show, id: @post.id @@ -44,4 +44,10 @@ class PostsController < ApplicationController redirect_to action: :index end + + private + + def post_params + params.require(:post).permit(:title, :text) + end end diff --git a/guides/code/getting_started/app/views/welcome/index.html.erb b/guides/code/getting_started/app/views/welcome/index.html.erb index 738e12d7dc..56be8dd3cc 100644 --- a/guides/code/getting_started/app/views/welcome/index.html.erb +++ b/guides/code/getting_started/app/views/welcome/index.html.erb @@ -1,3 +1,4 @@

    Hello, Rails!

    <%= link_to "My Blog", controller: "posts" %> +<%= link_to "New Post", new_post_path %> -- cgit v1.2.3 From ad62cf68f89506b0a5074fec8e08d104865aa0ee Mon Sep 17 00:00:00 2001 From: Burkhard Vogel-Kreykenbohm Date: Wed, 17 Jul 2013 11:49:47 +0200 Subject: bcrypt-ruby stable is 3.1 --- guides/code/getting_started/Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/code/getting_started') diff --git a/guides/code/getting_started/Gemfile b/guides/code/getting_started/Gemfile index acd2ed5160..3d57012901 100644 --- a/guides/code/getting_started/Gemfile +++ b/guides/code/getting_started/Gemfile @@ -31,7 +31,7 @@ end gem 'jbuilder', '~> 1.2' # To use ActiveModel has_secure_password -# gem 'bcrypt-ruby', '~> 3.0.0' +# gem 'bcrypt-ruby', '~> 3.1.0' # Use unicorn as the app server # gem 'unicorn' -- cgit v1.2.3 From 33efb448988212d36ed6ea7b1fc6c0a279defb69 Mon Sep 17 00:00:00 2001 From: David Padilla Date: Thu, 29 Aug 2013 15:28:08 -0500 Subject: Fix broken link to Fixtures documentation on guides and activerecord tests [ci skip] --- guides/code/getting_started/test/fixtures/comments.yml | 2 +- guides/code/getting_started/test/fixtures/posts.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'guides/code/getting_started') diff --git a/guides/code/getting_started/test/fixtures/comments.yml b/guides/code/getting_started/test/fixtures/comments.yml index 0cd36069e4..9e409d8a61 100644 --- a/guides/code/getting_started/test/fixtures/comments.yml +++ b/guides/code/getting_started/test/fixtures/comments.yml @@ -1,4 +1,4 @@ -# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html one: commenter: MyString diff --git a/guides/code/getting_started/test/fixtures/posts.yml b/guides/code/getting_started/test/fixtures/posts.yml index 617a24b858..46b01c3bb4 100644 --- a/guides/code/getting_started/test/fixtures/posts.yml +++ b/guides/code/getting_started/test/fixtures/posts.yml @@ -1,4 +1,4 @@ -# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html one: title: MyString -- cgit v1.2.3 From 4a99e1019931481011c621fe89f715fe6dac9dd3 Mon Sep 17 00:00:00 2001 From: "T.J. Schuck" Date: Mon, 23 Sep 2013 14:28:26 -0400 Subject: bcrypt-ruby v3.1.2 supports Ruby 2.0 on Windows --- guides/code/getting_started/Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/code/getting_started') diff --git a/guides/code/getting_started/Gemfile b/guides/code/getting_started/Gemfile index 3d57012901..eef6180804 100644 --- a/guides/code/getting_started/Gemfile +++ b/guides/code/getting_started/Gemfile @@ -31,7 +31,7 @@ end gem 'jbuilder', '~> 1.2' # To use ActiveModel has_secure_password -# gem 'bcrypt-ruby', '~> 3.1.0' +# gem 'bcrypt-ruby', '~> 3.1.2' # Use unicorn as the app server # gem 'unicorn' -- cgit v1.2.3 From d48222d22ef576c1b429ec2321c712bc221698d7 Mon Sep 17 00:00:00 2001 From: laurocaetano Date: Fri, 1 Nov 2013 18:15:53 -0200 Subject: remove warnings on ruby trunk --- guides/code/getting_started/config/boot.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/code/getting_started') diff --git a/guides/code/getting_started/config/boot.rb b/guides/code/getting_started/config/boot.rb index 3596736667..5e5f0c1fac 100644 --- a/guides/code/getting_started/config/boot.rb +++ b/guides/code/getting_started/config/boot.rb @@ -1,4 +1,4 @@ # Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) -require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) +require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) -- cgit v1.2.3 From bc010e7140856bb13dbc1ed60f07b3542a38b220 Mon Sep 17 00:00:00 2001 From: Dmitry Korotkov Date: Mon, 11 Nov 2013 11:17:44 +0400 Subject: Fix missing line and shadow on static error pages [ci skip] --- guides/code/getting_started/public/404.html | 2 ++ guides/code/getting_started/public/422.html | 2 ++ guides/code/getting_started/public/500.html | 2 ++ 3 files changed, 6 insertions(+) (limited to 'guides/code/getting_started') diff --git a/guides/code/getting_started/public/404.html b/guides/code/getting_started/public/404.html index 3d287b135d..3265cc8e33 100644 --- a/guides/code/getting_started/public/404.html +++ b/guides/code/getting_started/public/404.html @@ -22,6 +22,7 @@ border-top-right-radius: 9px; background-color: white; padding: 7px 4em 0 4em; + box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17); } h1 { @@ -37,6 +38,7 @@ background-color: #F7F7F7; border: 1px solid #CCC; border-right-color: #999; + border-left-color: #999; border-bottom-color: #999; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; diff --git a/guides/code/getting_started/public/422.html b/guides/code/getting_started/public/422.html index 3b946bf4a4..d823a8fc77 100644 --- a/guides/code/getting_started/public/422.html +++ b/guides/code/getting_started/public/422.html @@ -22,6 +22,7 @@ border-top-right-radius: 9px; background-color: white; padding: 7px 4em 0 4em; + box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17); } h1 { @@ -37,6 +38,7 @@ background-color: #F7F7F7; border: 1px solid #CCC; border-right-color: #999; + border-left-color: #999; border-bottom-color: #999; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; diff --git a/guides/code/getting_started/public/500.html b/guides/code/getting_started/public/500.html index ccc4ad5656..ebf6d4c00c 100644 --- a/guides/code/getting_started/public/500.html +++ b/guides/code/getting_started/public/500.html @@ -22,6 +22,7 @@ border-top-right-radius: 9px; background-color: white; padding: 7px 4em 0 4em; + box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17); } h1 { @@ -37,6 +38,7 @@ background-color: #F7F7F7; border: 1px solid #CCC; border-right-color: #999; + border-left-color: #999; border-bottom-color: #999; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; -- cgit v1.2.3 From 9c7eb4085824aefc98f5f3157a3ce00c9c4e4fe5 Mon Sep 17 00:00:00 2001 From: Christophe Maximin Date: Fri, 29 Nov 2013 10:48:41 -0400 Subject: Fix URL to robots.txt documentation --- guides/code/getting_started/public/robots.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/code/getting_started') diff --git a/guides/code/getting_started/public/robots.txt b/guides/code/getting_started/public/robots.txt index 1a3a5e4dd2..3c9c7c01f3 100644 --- a/guides/code/getting_started/public/robots.txt +++ b/guides/code/getting_started/public/robots.txt @@ -1,4 +1,4 @@ -# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file +# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file # # To ban all spiders from the entire site uncomment the next two lines: # User-agent: * -- cgit v1.2.3 From e1aaa2ff73f78db89721eee2517eeb689f84a5a1 Mon Sep 17 00:00:00 2001 From: Pavel Pravosud Date: Fri, 20 Dec 2013 10:35:32 -0500 Subject: Bump Jbuilder version to 2.0.0 --- guides/code/getting_started/Gemfile | 2 +- guides/code/getting_started/Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'guides/code/getting_started') diff --git a/guides/code/getting_started/Gemfile b/guides/code/getting_started/Gemfile index eef6180804..d573488bdb 100644 --- a/guides/code/getting_started/Gemfile +++ b/guides/code/getting_started/Gemfile @@ -28,7 +28,7 @@ group :doc do end # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder -gem 'jbuilder', '~> 1.2' +gem 'jbuilder', '~> 2.0' # To use ActiveModel has_secure_password # gem 'bcrypt-ruby', '~> 3.1.2' diff --git a/guides/code/getting_started/Gemfile.lock b/guides/code/getting_started/Gemfile.lock index 2d5c50ef5c..1c30ac5d75 100644 --- a/guides/code/getting_started/Gemfile.lock +++ b/guides/code/getting_started/Gemfile.lock @@ -40,7 +40,7 @@ GEM multi_json (~> 1.0) hike (1.2.3) i18n (0.6.4) - jbuilder (1.4.2) + jbuilder (2.0.0) activesupport (>= 3.0.0) multi_json (>= 1.2.0) jquery-rails (3.0.2) @@ -110,7 +110,7 @@ PLATFORMS DEPENDENCIES coffee-rails - jbuilder (~> 1.2) + jbuilder (~> 2.0) jquery-rails rails (= 4.0.0) sass-rails -- cgit v1.2.3 From 72bb3fc297a3548e6748867bfb55a077b7b7728c Mon Sep 17 00:00:00 2001 From: "T.J. Schuck" Date: Fri, 3 Jan 2014 17:02:31 -0500 Subject: Change all "can not"s to the correct "cannot". --- guides/code/getting_started/config/environments/production.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/code/getting_started') diff --git a/guides/code/getting_started/config/environments/production.rb b/guides/code/getting_started/config/environments/production.rb index 368a735122..93d44723fb 100644 --- a/guides/code/getting_started/config/environments/production.rb +++ b/guides/code/getting_started/config/environments/production.rb @@ -66,7 +66,7 @@ Blog::Application.configure do # config.action_mailer.raise_delivery_errors = false # Enable locale fallbacks for I18n (makes lookups for any locale fall back to - # the I18n.default_locale when a translation can not be found). + # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true # Send deprecation notices to registered listeners. -- cgit v1.2.3