$ rails new commandsapp
- create
+ create
create README
create .gitignore
create Rakefile
@@ -570,7 +570,7 @@ h5. +test:+ Rails tests
INFO: A good description of unit testing in Rails is given in "A Guide to Testing Rails Applications":testing.html
-Rails comes with a test suite called Test::Unit. It is through the use of tests that Rails itself is so stable, and the slew of people working on Rails can prove that everything works as it should.
+Rails comes with a test suite called Test::Unit. It is through the use of tests that Rails itself is so stable, and the slew of people working on Rails can prove that everything works as it should.
The +test:+ namespace helps in running the different tests you will (hopefully!) write.
diff --git a/railties/guides/source/configuring.textile b/railties/guides/source/configuring.textile
index 9e0c7cd0609ab..81ef9108225a9 100644
--- a/railties/guides/source/configuring.textile
+++ b/railties/guides/source/configuring.textile
@@ -51,15 +51,15 @@ h4. Rails General Configuration
* +config.dependency_loading+ enables or disables dependency loading during the request cycle. Setting dependency_loading to _true_ will allow new classes to be loaded during a request and setting it to _false_ will disable this behavior.
-* +config.eager_load_paths+ accepts an array of paths from which Rails will eager load on boot if cache classes is enabled. All elements of this array must also be in +load_paths+.
+* +config.eager_load_paths+ accepts an array of paths from which Rails will eager load on boot if cache classes is enabled. All elements of this array must also be in +load_paths+.
* +config.load_once_paths+ accepts an array of paths from which Rails will automatically load from only once. All elements of this array must also be in +load_paths+.
-* +config.load_paths+ accepts an array of additional paths to prepend to the load path. By default, all app, lib, vendor and mock paths are included in this list.
+* +config.load_paths+ accepts an array of additional paths to prepend to the load path. By default, all app, lib, vendor and mock paths are included in this list.
-* +config.log_level+ defines the verbosity of the Rails logger. In production mode, this defaults to +:info+. In development mode, it defaults to +:debug+.
+* +config.log_level+ defines the verbosity of the Rails logger. In production mode, this defaults to +:info+. In development mode, it defaults to +:debug+.
-* +config.log_path+ overrides the path to the log file to use. Defaults to +log/#{environment}.log+ (e.g. log/development.log or log/production.log).
+* +config.log_path+ overrides the path to the log file to use. Defaults to +log/#{environment}.log+ (e.g. log/development.log or log/production.log).
* +config.logger+ accepts a logger conforming to the interface of Log4r or the default Ruby 1.8+ Logger class, which is then used to log information from Action Controller. Set to nil to disable logging.
@@ -73,7 +73,7 @@ h4. Rails General Configuration
* +config.preload_frameworks+ enables or disables preloading all frameworks at startup.
-* +config.reload_plugins+ enables or disables plugin reloading.
+* +config.reload_plugins+ enables or disables plugin reloading.
* +config.root_path+ configures the root path of the application.
diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile
index ffb031081649e..270fbe76d29a3 100644
--- a/railties/guides/source/getting_started.textile
+++ b/railties/guides/source/getting_started.textile
@@ -475,13 +475,13 @@ After the console loads, you can use it to work with your application's models:
>> p = Post.new(:content => "A new post")
-=> # #
>> p.save
=> false
>> p.errors
-=> #["can't be blank",
+=> #["can't be blank",
"is too short (minimum is 5 characters)"],
:name=>["can't be blank"] }>
@@ -742,7 +742,7 @@ def update
respond_to do |format|
if @post.update_attributes(params[:post])
- format.html { redirect_to(@post,
+ format.html { redirect_to(@post,
:notice => 'Post was successfully updated.') }
format.xml { head :ok }
else
@@ -1056,7 +1056,7 @@ Then in the +app/views/posts/show.html.erb+ you can change it to look like the f
Comments
-<%= render :partial => "comments/comment",
+<%= render :partial => "comments/comment",
:collection => @post.comments %>
Add a comment:
@@ -1127,7 +1127,7 @@ Then you make the +app/views/posts/show.html.erb+ look like the following:
Comments
-<%= render :partial => "comments/comment",
+<%= render :partial => "comments/comment",
:collection => @post.comments %>
Add a comment:
@@ -1213,15 +1213,15 @@ Rails provides a very simple HTTP authentication system that will work nicely in
class ApplicationController < ActionController::Base
protect_from_forgery
-
+
private
-
+
def authenticate
authenticate_or_request_with_http_basic do |user_name, password|
user_name == 'admin' && password == 'password'
end
end
-
+
end
@@ -1381,7 +1381,7 @@ Finally, we will edit the app/views/posts/show.html.erb template to sho
Comments
-<%= render :partial => "comments/comment",
+<%= render :partial => "comments/comment",
:collection => @post.comments %>
Add a comment:
@@ -1405,7 +1405,7 @@ Open up app/helpers/posts_helper.rb and add the following:
module PostsHelper
def join_tags(post)
- post.tags.map { |t| t.name }.join(", ")
+ post.tags.map { |t| t.name }.join(", ")
end
end
@@ -1436,7 +1436,7 @@ Now you can edit the view in app/views/posts/show.html.erb to look like
Comments
-<%= render :partial => "comments/comment",
+<%= render :partial => "comments/comment",
:collection => @post.comments %>
Add a comment:
diff --git a/railties/guides/source/i18n.textile b/railties/guides/source/i18n.textile
index 63d22db485c1c..1af51af80ed6e 100644
--- a/railties/guides/source/i18n.textile
+++ b/railties/guides/source/i18n.textile
@@ -518,7 +518,7 @@ es:
title: "Título"
-you can look up the +books.index.title+ value *inside* +app/views/books/index.html.erb+ template like this (note the dot):
+you can look up the +books.index.title+ value *inside* +app/views/books/index.html.erb+ template like this (note the dot):
<%= t '.title' %>
diff --git a/railties/guides/source/initialization.textile b/railties/guides/source/initialization.textile
index f80c00b2801f3..4e257d2e00866 100644
--- a/railties/guides/source/initialization.textile
+++ b/railties/guides/source/initialization.textile
@@ -229,7 +229,7 @@ This file goes on to define some classes that will be automatically loaded using
require "active_support/inflector/methods"
require "active_support/lazy_load_hooks"
-
+
module ActiveSupport
module Autoload
def self.extended(base)
@@ -250,7 +250,7 @@ This file goes on to define some classes that will be automatically loaded using
end
super const_name, location
end
-
+
...
end
end
@@ -337,7 +337,7 @@ As you can see for the duration of the +eager_autoload+ block the class variable
autoload :I18n, "active_support/i18n"
-So we know the ones in +eager_autoload+ are eagerly loaded and it does this by storing them in an +@@autoloads+ hash object and then loading them via +eager_autoload!+ which is called via the +preload_frameworks+ initializer defined in _railties/lib/rails/application/bootstrap.rb_.
+So we know the ones in +eager_autoload+ are eagerly loaded and it does this by storing them in an +@@autoloads+ hash object and then loading them via +eager_autoload!+ which is called via the +preload_frameworks+ initializer defined in _railties/lib/rails/application/bootstrap.rb_.
The classes and modules that are not +eager_autoload+'d are automatically loaded as they are references
@@ -423,16 +423,16 @@ Now that Rails has required Action Dispatch and it has required Rack, Rails can
module Rails
class Server < ::Rack::Server
-
+
...
-
+
def initialize(*)
super
set_environment
end
-
+
...
-
+
def set_environment
ENV["RAILS_ENV"] ||= options[:environment]
end
@@ -486,7 +486,7 @@ And +default_options+ like this:
:AccessLog => [],
:config => "config.ru"
}
- end
+ end
Here it is important to note that the default environment is _development_. After +Rack::Server#initialize+ has done its thing it returns to +Rails::Server#initialize+ which calls +set_environment+:
@@ -752,7 +752,7 @@ If you wish to know more about how they're deprecated see the +require 'active_s
h4. +require 'rails/log_subscriber'+
-The +Rails::LogSubscriber+ provides a central location for logging in Rails 3 so as to not slow down the main thread. When you call one of the logging methods (+info+, +debug+, +warn+, +error+, +fatal+ or +unknown+) from the +Rails::LogSubscriber+ class or one of its subclasses this will notify the Rails logger to log this call in the fashion you specify, but will not write it to the file. The file writing is done at the end of the request, courtesy of the +Rails::Rack::Logger+ middleware.
+The +Rails::LogSubscriber+ provides a central location for logging in Rails 3 so as to not slow down the main thread. When you call one of the logging methods (+info+, +debug+, +warn+, +error+, +fatal+ or +unknown+) from the +Rails::LogSubscriber+ class or one of its subclasses this will notify the Rails logger to log this call in the fashion you specify, but will not write it to the file. The file writing is done at the end of the request, courtesy of the +Rails::Rack::Logger+ middleware.
Each Railtie defines its own class that descends from +Rails::LogSubscriber+ with each defining its own methods for logging individual tasks.
@@ -821,7 +821,7 @@ TODO: Quotify.
Active Record connects business objects and database tables to create a persistable domain model where logic and data are presented in one wrapping. It's an implementation of the object-relational mapping (ORM) pattern by the same name as described by Martin Fowler:
- "An object that wraps a row in a database table or view, encapsulates
+ "An object that wraps a row in a database table or view, encapsulates
the database access, and adds domain logic on that data."
Active Record's main contribution to the pattern is to relieve the original of two stunting problems:
@@ -910,7 +910,7 @@ h5. +require 'active_record'+
Back the initial require from the _railtie.rb_.
-The _active_support_ and _active_model_ requires are again just an insurance for if we're loading Active Record outside of the scope of Rails. In _active_record.rb_ the ActiveRecord +Module+ is initialized and in it there is defined a couple of +autoloads+ and +eager_autoloads+.
+The _active_support_ and _active_model_ requires are again just an insurance for if we're loading Active Record outside of the scope of Rails. In _active_record.rb_ the ActiveRecord +Module+ is initialized and in it there is defined a couple of +autoloads+ and +eager_autoloads+.
There's a new method here called +autoload_under+ which is defined in +ActiveSupport::Autoload+. This sets the autoload path to temporarily be the specified path, in this case +relation+ for the +autoload+'d classes inside the block.
@@ -935,7 +935,7 @@ Inside the Active Record Railtie the +ActiveRecord::Railtie+ class is defined:
module ActiveRecord
class Railtie < Rails::Railtie
-
+
...
end
end
@@ -964,8 +964,8 @@ This Railtie is +require+'d by Active Record's Railtie.
From the Active Model readme:
- Prior to Rails 3.0, if a plugin or gem developer wanted to be able to have an object interact with Action Pack helpers, it was required to either copy chunks of code from Rails, or monkey patch entire helpers to make them handle objects that did not look like Active Record. This generated code duplication and fragile applications that broke on upgrades.
-
+ Prior to Rails 3.0, if a plugin or gem developer wanted to be able to have an object interact with Action Pack helpers, it was required to either copy chunks of code from Rails, or monkey patch entire helpers to make them handle objects that did not look like Active Record. This generated code duplication and fragile applications that broke on upgrades.
+
Active Model is a solution for this problem.
Active Model provides a known set of interfaces that your objects can implement to then present a common interface to the Action Pack helpers.
@@ -999,7 +999,7 @@ This first makes a couple of requires:
require "action_view/railtie"
-The _action_controller_ file is explained in the very next section. The require to _rails_ is requiring the already-required _railties/lib/rails.rb_. If you wish to know about the require to _action_view/railtie_ this is explained in the Action View Railtie section.
+The _action_controller_ file is explained in the very next section. The require to _rails_ is requiring the already-required _railties/lib/rails.rb_. If you wish to know about the require to _action_view/railtie_ this is explained in the Action View Railtie section.
h5. +require 'action_controller+
@@ -1009,7 +1009,7 @@ h5. +require 'abstract_controller'+
+AbstractController+ provides the functionality of TODO.
-This file is in _actionpack/lib/abstract_controller.rb_ and begins by attempting to add the path to Active Support to the load path, which it would succeed in if it wasn't already set by anything loaded before it. In this case, it's not going to be set due to Arel already loading it in (TODO: right?).
+This file is in _actionpack/lib/abstract_controller.rb_ and begins by attempting to add the path to Active Support to the load path, which it would succeed in if it wasn't already set by anything loaded before it. In this case, it's not going to be set due to Arel already loading it in (TODO: right?).
The next thing in this file four +require+ calls:
@@ -1146,9 +1146,9 @@ For an explanation of this file _activesupport/lib/active_support/core_ext/class
h5. +require 'active_support/deprecation/proxy_wrappers'+
-This file, _activesupport/lib/active_support/deprecation/proxy_wrappers.rb_, defines a couple of deprecation classes, which are +DeprecationProxy+, +DeprecationObjectProxy+, +DeprecationInstanceVariableProxy+, +DeprecationConstantProxy+ which are all namespaced into +ActiveSupport::Deprecation+. These last three are all subclasses of +DeprecationProxy+.
+This file, _activesupport/lib/active_support/deprecation/proxy_wrappers.rb_, defines a couple of deprecation classes, which are +DeprecationProxy+, +DeprecationObjectProxy+, +DeprecationInstanceVariableProxy+, +DeprecationConstantProxy+ which are all namespaced into +ActiveSupport::Deprecation+. These last three are all subclasses of +DeprecationProxy+.
-Why do we mention them here? Beside the obvious-by-now fact that we're covering just about everything about the initialization process in this guide, if you're deprecating something in your library and you use Active Support, you too can use the +DeprecationProxy+ class (and it's subclasses) too.
+Why do we mention them here? Beside the obvious-by-now fact that we're covering just about everything about the initialization process in this guide, if you're deprecating something in your library and you use Active Support, you too can use the +DeprecationProxy+ class (and it's subclasses) too.
h6. +DeprecationProxy+
@@ -1177,7 +1177,7 @@ This class is used only in _railties/lib/rails/deprecation.rb_, loaded further o
end).new
-There is similar definitions for the other constants of +RAILS_ENV+ and +RAILS_DEFAULT_LOGGER+. All three of these constants are in the midst of being deprecated (most likely in Rails 3.1) so Rails will tell you if you reference them that they're deprecated using the +DeprecationProxy+ class. Whenever you call +RAILS_ROOT+ this will raise a warning, telling you: "RAILS_ROOT is deprecated! Use Rails.root instead".... TODO: investigate if simply calling it does raise this warning. This same rule applies to +RAILS_ENV+ and +RAILS_DEFAULT_LOGGER+, their new alternatives are +Rails.env+ and +Rails.logger+ respectively.
+There is similar definitions for the other constants of +RAILS_ENV+ and +RAILS_DEFAULT_LOGGER+. All three of these constants are in the midst of being deprecated (most likely in Rails 3.1) so Rails will tell you if you reference them that they're deprecated using the +DeprecationProxy+ class. Whenever you call +RAILS_ROOT+ this will raise a warning, telling you: "RAILS_ROOT is deprecated! Use Rails.root instead".... TODO: investigate if simply calling it does raise this warning. This same rule applies to +RAILS_ENV+ and +RAILS_DEFAULT_LOGGER+, their new alternatives are +Rails.env+ and +Rails.logger+ respectively.
h6. +DeprecatedObjectProxy+
@@ -1203,7 +1203,7 @@ This makes more sense in the wider scope of the initializer:
end
-+ActionController::Routing::Routes+ was the previous constant used in defining routes in Rails 2 applications, now it's simply a method on +Rails.application+ rather than it's own individual class: +Rails.application.routes+. Both of these still call the +draw+ method on the returned object to end up defining the routes.
++ActionController::Routing::Routes+ was the previous constant used in defining routes in Rails 2 applications, now it's simply a method on +Rails.application+ rather than it's own individual class: +Rails.application.routes+. Both of these still call the +draw+ method on the returned object to end up defining the routes.
h6. +DeprecatedInstanceVariableProxy+
@@ -1362,7 +1362,7 @@ Here again we have the addition of the path to Active Support to the load path a
And these have already been required. If you wish to know what these files do go to the explanation of each in the "Common Includes" section. TODO: link to them!
-This file goes on to +require 'action_pack'+ which consists of all this code (comments stripped):
+This file goes on to +require 'action_pack'+ which consists of all this code (comments stripped):
require 'action_pack/version'
@@ -1445,11 +1445,11 @@ After including +ActiveSupport::Benchmarkable+, the helpers which we have declar
h5. +ActionView::Rendering+
-This module, from _actionpack/lib/action_view/render/rendering.rb_ defines a method you may be a little too familiar with: +render+. This is the +render+ use for rendering all kinds of things, such as partials, templates and text.
+This module, from _actionpack/lib/action_view/render/rendering.rb_ defines a method you may be a little too familiar with: +render+. This is the +render+ use for rendering all kinds of things, such as partials, templates and text.
h5. +ActionView::Partials+
-This module, from _actionpack/lib/action_view/render/partials.rb_, defines +ActionView::Partials::PartialRenderer+ which you can probably guess is used for rendering partials.
+This module, from _actionpack/lib/action_view/render/partials.rb_, defines +ActionView::Partials::PartialRenderer+ which you can probably guess is used for rendering partials.
h5. +ActionView::Layouts+
@@ -1487,7 +1487,7 @@ Next, the Railtie itself is defined:
end
end
end
-
+
The +ActionView::LogSubscriber+ sets up a method called +render_template+ which is called when a template is rendered. TODO: Templates only or partials and layouts also? I would imagine these fall under the templates category, but there needs to research to ensure this is correct.
@@ -1502,7 +1502,7 @@ are used to consolidate code for sending out forgotten passwords, welcome
wishes on signup, invoices for billing, and any other use case that requires
a written notification to either a person or another system.
-Action Mailer is in essence a wrapper around Action Controller and the
+Action Mailer is in essence a wrapper around Action Controller and the
Mail gem. It provides a way to make emails using templates in the same
way that Action Controller renders views using templates.
@@ -1580,7 +1580,7 @@ which is used by the +ActionMailer::MailerHelper+ method +block_format+:
:columns => 72, :first_indent => 2, :body_indent => 2, :text => paragraph
).format
}.join("\n")
-
+
# Make list points stand on their own line
formatted.gsub!(/[ ]*([*]+) ([^*]*)/) { |s| " #{$1} #{$2.strip}\n" }
formatted.gsub!(/[ ]*([#]+) ([^#]*)/) { |s| " #{$1} #{$2.strip}\n" }
@@ -1687,7 +1687,7 @@ There is only one initializer defined here: +set_configs+. This is covered later
h4. ActionDispatch Railtie
-ActionDispatch handles all dispatch work for Rails. It interfaces with Action Controller to determine what action to undertake when a request comes in. TODO: I would quote the README but it is strangely absent. Flyin' blind here!
+ActionDispatch handles all dispatch work for Rails. It interfaces with Action Controller to determine what action to undertake when a request comes in. TODO: I would quote the README but it is strangely absent. Flyin' blind here!
The ActionDispatch Railtie was previously required when we called +require 'rails'+, but we will cover the Railtie here too.
@@ -1817,7 +1817,7 @@ This +called_from+ setting looks a little overwhelming to begin with, but the sh
base.send(:include, self::Configurable)
subclasses << base
end
- end
+ end
Again, +YourApp::Application+ will return false for +abstract_railtie+ and so the code inside the +unless+ will be ran. The first line:
@@ -1886,7 +1886,7 @@ Now that we've covered the boot process of Rails the next line best to cover wou
Rails::Server.start
-The keen-eyed observer will note that this +when+ also specifies the argument could also be simply +'s'+ thereby making the full command +rails s+. This is the same with the other commands with +generate+ becoming +g+, +console+ becoming +c+ and +dbconsole+ becoming +db+.
+The keen-eyed observer will note that this +when+ also specifies the argument could also be simply +'s'+ thereby making the full command +rails s+. This is the same with the other commands with +generate+ becoming +g+, +console+ becoming +c+ and +dbconsole+ becoming +db+.
This code here ensures we are at the +ROOT_PATH+ of our application (this constant was defined in _script/rails_) and then calls +Rails::Server.start+. +Rails::Server+ descends from +Rack::Server+ which is defined in the rack gem. The +Rails::Server.start+ method is defined like this:
@@ -1997,7 +1997,7 @@ Finally! We've arrived at +default_options+ which leads into our next point quit
end
-We're not debugging anything, so there goes the first 7 lines, we're not warning, nor are we including, requiring, daemonising or writing out a pid file. That's everything except the final line, which calls +run+ with the +wrapped_app+ which is then defined like this:
+We're not debugging anything, so there goes the first 7 lines, we're not warning, nor are we including, requiring, daemonising or writing out a pid file. That's everything except the final line, which calls +run+ with the +wrapped_app+ which is then defined like this:
def wrapped_app
@@ -2051,7 +2051,7 @@ First this reads your config file and checks it for +#\+ at the beginning. This
require ::File.expand_path('../config/environment', __FILE__)
run YourApp::Application.instance
-
+
TODO: Is the above correct? I am simply guessing!
@@ -2246,7 +2246,7 @@ The method +find_with_root_flag+ is defined on +Rails::Engine+ (the superclass o
Pathname.new(root).expand_path : Pathname.new(root).realpath
end
-
+
+called_from+ goes through the +caller+ which is the stacktrace of the current thread, in the case of your application it would go a little like this:
@@ -2274,7 +2274,7 @@ The method +find_with_root_flag+ is defined on +Rails::Engine+ (the superclass o
end
-The +call_stack+ here is the +caller+ output shown previously, minus everything after the first +:+ on all the lines. The first path that matches this is _/usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0.beta1/lib/rails_. Yours may vary slightly, but should always end in _railties-x.x.x/lib/rails_.
+The +call_stack+ here is the +caller+ output shown previously, minus everything after the first +:+ on all the lines. The first path that matches this is _/usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0.beta1/lib/rails_. Yours may vary slightly, but should always end in _railties-x.x.x/lib/rails_.
The code in +find_root_with_flag+ will go up this directory structure until it reaches the top, which in this case is +/+.
@@ -2302,7 +2302,7 @@ At the root of the system it looks for +config.ru+. TODO: Why? Obviously it's no
@serve_static_assets = true
@time_zone = "UTC"
@consider_all_requests_local = true
- end
+ end
The +super+ method here is the +initialize+ method in +Rails::Engine::Configuration+:
@@ -2604,7 +2604,7 @@ The +plugins+ method it calls is a little more complex:
When we call +@config.paths.vendor.plugins+ it will return +"vendor/plugins"+.
-
+
If you've defined specific plugin requirements for your application in _config/application.rb_ by using this code:
@@ -2725,7 +2725,7 @@ Now we finally have all the +initializers+ we can go through them and call +run+
end
-You may remember that the +@context+ in this code is +YourApp::Application+ and calling +instance_exec+ on this class will make a new instance of it and execute the code within the +&block+ passed to it. This code within the block is the code from all the initializers.
+You may remember that the +@context+ in this code is +YourApp::Application+ and calling +instance_exec+ on this class will make a new instance of it and execute the code within the +&block+ passed to it. This code within the block is the code from all the initializers.
h3. Bootstrap Initializers
@@ -2759,15 +2759,15 @@ We've seen +config.paths+ before when loading the plugins and they're explained
module Rails
class << self
-
+
...
-
+
def env
@_env ||= ActiveSupport::StringInquirer.new(ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development")
end
-
+
...
-
+
end
end
@@ -2953,7 +2953,7 @@ This is where it gets loaded. The +eager_autoload!+ method is defined like this:
end
-With +@@autoloads+ being
+With +@@autoloads+ being
* load_all_active_support
@@ -3144,9 +3144,9 @@ h4. +ActionDispatch::MiddlewareStack.new+
module ActionDispatch
class MiddlewareStack < Array
-
+
...
-
+
def initialize(*args, &block)
super(*args)
block.call(self) if block_given?
@@ -3188,9 +3188,9 @@ This +initialize+ method also is in a class who's ancestry is important so once
module ActionController
class Middleware < Metal
-
+
...
-
+
def initialize(app)
super()
@_app = app
@@ -3207,9 +3207,9 @@ This is another subclassed class, this time from +ActionController::AbstractCont
class Metal < AbstractController::Base
-
+
...
-
+
def initialize(*)
@_headers = {}
super
@@ -3217,7 +3217,7 @@ This is another subclassed class, this time from +ActionController::AbstractCont
end
-The single +*+ in the argument listing means we can accept any number of arguments, we just don't care what they are.
+The single +*+ in the argument listing means we can accept any number of arguments, we just don't care what they are.
h4. +AbstractController::Base.initialize+
@@ -3232,7 +3232,7 @@ This may be anti-climatic, but the initialize method here just returns an +Abstr
h4. +ActionDispatch::MiddlewareStack.use+
-Now we're back to this method, from our foray into the depths of how +Middleware.new+ works, we've showed that it is an instance of +AbstractController::Base+. Therefore it does
+Now we're back to this method, from our foray into the depths of how +Middleware.new+ works, we've showed that it is an instance of +AbstractController::Base+. Therefore it does
TODO: ELABORATE ON THIS SECTION, including explaining what all the pieces of middleware do. Then explain how the default_middleware_stack does what it does, whatever that is.
@@ -3309,7 +3309,7 @@ In a standard Rails application we have this in our _config/environments/develop
end
-It's a little bit sneaky here, but +configure+ is +alias+'d to +class_eval+ on subclasses of +Rails::Application+ which of course includes +YourApp::Application+. This means that the code inside the +configure do+ block will be evaled within the context of +YourApp::Application+. The +config+ method here is the one mentioned before: the +Rails::Application::Configuration+ object. The methods on it should look familiar too: they're the ones that had +attr_accessor+ and +attr_writer+ definitions.
+It's a little bit sneaky here, but +configure+ is +alias+'d to +class_eval+ on subclasses of +Rails::Application+ which of course includes +YourApp::Application+. This means that the code inside the +configure do+ block will be evaled within the context of +YourApp::Application+. The +config+ method here is the one mentioned before: the +Rails::Application::Configuration+ object. The methods on it should look familiar too: they're the ones that had +attr_accessor+ and +attr_writer+ definitions.
The ones down the bottom, +config.action_controller+, +config.action_view+ and +config.action_mailer+ aren't defined by +attr_accessor+ or +attr_writer+, rather they're undefined methods and therefore will trigger the +method_missing+ on the +Rails::Application::Configuration+ option.
@@ -3381,7 +3381,7 @@ I'm going to show you two methods since the third one, +self.plugin_name+, calls
@plugins ||= []
@plugins << klass unless klass == Plugin
end
-
+
def self.plugins
@plugins
end
@@ -3472,7 +3472,7 @@ h5. +Rack::Handler::WEBrick+
This class is subclassed from +WEBrick::HTTPServlet::AbstractServlet+ which is a class that comes with the Ruby standard library. This is the magical class that serves the requests and deals with the comings (requests) and goings (responses) for your server.
-+Rack::Server+ has handlers for the request and by default the handler for a _rails server_ server is
++Rack::Server+ has handlers for the request and by default the handler for a _rails server_ server is
h3. Cruft!
@@ -3706,7 +3706,7 @@ This file is _activesupport/lib/active_support/inflector.rb_ and makes a couple
require 'active_support/core_ext/string/inflections'
-The files included here define methods for modifying strings, such as +transliterate+ which will convert a Unicode string to its ASCII version, +parameterize+ for making strings into url-safe versions, +camelize+ for camel-casing a string such as +string_other+ into +StringOther+ and +ordinalize+ converting a string such as +101+ into +101st+. More information about these methods can be found in the Active Support Core Extensions Guide. TODO: Link to AS Guide.
+The files included here define methods for modifying strings, such as +transliterate+ which will convert a Unicode string to its ASCII version, +parameterize+ for making strings into url-safe versions, +camelize+ for camel-casing a string such as +string_other+ into +StringOther+ and +ordinalize+ converting a string such as +101+ into +101st+. More information about these methods can be found in the Active Support Core Extensions Guide. TODO: Link to AS Guide.
h4. +require 'active_support/core_ext/module/delegation'+
@@ -3715,7 +3715,7 @@ _activesupport/lib/active_support/core_ext/module/delegation.rb_ defines the +de
class Client < ActiveRecord::Base
has_one :address
-
+
delegate :address_line_1, :to => :address
end
@@ -3736,7 +3736,7 @@ h4. +require 'active_support/core_ext/class/attribute_accessors'+
The file, _activesupport/lib/active_support/core_ext/class/attribute_accessors.rb_, defines the class accessor methods +cattr_writer+, +cattr_reader+ and +cattr_accessor+. +cattr_accessor+ defines a +cattr_reader+ and +cattr_writer+ for the symbol passed in. These methods work by defining class variables when you call their dynamic methods.
-Throughout the Railties there a couple of common includes. They are listed here for your convenience.
+Throughout the Railties there a couple of common includes. They are listed here for your convenience.
h4. +require 'active_support/core_ext/module/attr_internal+
diff --git a/railties/guides/source/layouts_and_rendering.textile b/railties/guides/source/layouts_and_rendering.textile
index b9a201e5f0b62..fe5b4c8773e21 100644
--- a/railties/guides/source/layouts_and_rendering.textile
+++ b/railties/guides/source/layouts_and_rendering.textile
@@ -143,7 +143,7 @@ def update
end
-If the call to +update_attributes+ fails, calling the +update+ action in this controller will render the +edit.html.erb+ template belonging to the same controller.
+If the call to +update_attributes+ fails, calling the +update+ action in this controller will render the +edit.html.erb+ template belonging to the same controller.
If you prefer, you can use a symbol instead of a string to specify the action to render:
@@ -200,7 +200,7 @@ render "/u/apps/warehouse_app/current/app/views/products/show"
Rails determines that this is a file render because of the leading slash character. To be explicit, you can use the +:file+ option (which was required on Rails 2.2 and earlier):
-render :file =>
+render :file =>
"/u/apps/warehouse_app/current/app/views/products/show"
@@ -240,7 +240,7 @@ h5. Using +render+ with +:inline+
The +render+ method can do without a view completely, if you're willing to use the +:inline+ option to supply ERB as part of the method call. This is perfectly valid:
-render :inline =>
+render :inline =>
"<% products.each do |p| %><%= p.name %>
<% end %>"
@@ -249,7 +249,7 @@ WARNING: There is seldom any good reason to use this option. Mixing ERB into you
By default, inline rendering uses ERb. You can force it to use Builder instead with the +:type+ option:
-render :inline =>
+render :inline =>
"xml.p {'Horrid coding practice!'}", :type => :builder
@@ -676,7 +676,7 @@ h5. Linking to Feeds with +auto_discovery_link_tag+
The +auto_discovery_link_tag+ helper builds HTML that most browsers and newsreaders can use to detect the presences of RSS or ATOM feeds. It takes the type of the link (+:rss+ or +:atom+), a hash of options that are passed through to url_for, and a hash of options for the tag:
-<%= auto_discovery_link_tag(:rss, {:action => "feed"},
+<%= auto_discovery_link_tag(:rss, {:action => "feed"},
{:title => "RSS Feed"}) %>
@@ -739,7 +739,7 @@ If you're loading multiple javascript files, you can create a better user experi
By default, the combined file will be delivered as +javascripts/all.js+. You can specify a location for the cached asset file instead:
-<%= javascript_include_tag "main", "columns",
+<%= javascript_include_tag "main", "columns",
:cache => 'cache/main/display' %>
@@ -798,7 +798,7 @@ If you're loading multiple CSS files, you can create a better user experience by
By default, the combined file will be delivered as +stylesheets/all.css+. You can specify a location for the cached asset file instead:
-<%= stylesheet_link_tag "main", "columns",
+<%= stylesheet_link_tag "main", "columns",
:cache => 'cache/main/display' %>
@@ -1085,7 +1085,7 @@ Partials are very useful in rendering collections. When you pass a collection to
Product Name: <%= product.name %>
-When a partial is called with a pluralized collection, then the individual instances of the partial have access to the member of the collection being rendered via a variable named after the partial. In this case, the partial is +_product+, and within the +_product+ partial, you can refer to +product+ to get the instance that is being rendered.
+When a partial is called with a pluralized collection, then the individual instances of the partial have access to the member of the collection being rendered via a variable named after the partial. In this case, the partial is +_product+, and within the +_product+ partial, you can refer to +product+ to get the instance that is being rendered.
In Rails 3.0 there is also a shorthand for this, assuming +@posts+ is a collection of +post+ instances, you can simply do in the +index.html.erb+:
@@ -1132,7 +1132,7 @@ With this change, you can access an instance of the +@products+ collection as th
You can also pass in arbitrary local variables to any partial you are rendering with the +:locals => {}+ option:
-<%= render :partial => 'products', :collection => @products,
+<%= render :partial => 'products', :collection => @products,
:as => :item, :locals => {:title => "Products Page"} %>
diff --git a/railties/guides/source/nested_model_forms.textile b/railties/guides/source/nested_model_forms.textile
index 39b0c32f2459a..1d44da4df14f5 100644
--- a/railties/guides/source/nested_model_forms.textile
+++ b/railties/guides/source/nested_model_forms.textile
@@ -63,7 +63,7 @@ class Person
def address
Address.new
end
-
+
def address_attributes=(attributes)
# ...
end
@@ -77,7 +77,7 @@ class Person
def projects
[Project.new, Project.new]
end
-
+
def projects_attributes=(attributes)
# ...
end
@@ -101,7 +101,7 @@ class PeopleController < ActionController:Base
@person.built_address
2.times { @person.projects.build }
end
-
+
def create
@person = Person.new(params[:person])
if @person.save
@@ -142,7 +142,7 @@ Now add a nested form for the +address+ association:
<%= form_for @person do |f| %>
<%= f.text_field :name %>
-
+
<%= f.fields_for :address do |af| %>
<%= f.text_field :street %>
<% end %>
@@ -154,7 +154,7 @@ This generates:
@@ -183,7 +183,7 @@ The form code for an association collection is pretty similar to that of a singl
<%= form_for @person do |f| %>
<%= f.text_field :name %>
-
+
<%= f.fields_for :projects do |pf| %>
<%= f.text_field :name %>
<% end %>
@@ -195,7 +195,7 @@ Which generates:
diff --git a/railties/guides/source/plugins.textile b/railties/guides/source/plugins.textile
index 82f22761534de..f89043f216478 100644
--- a/railties/guides/source/plugins.textile
+++ b/railties/guides/source/plugins.textile
@@ -323,7 +323,7 @@ Finally, create the +core_ext.rb+ file and add the +to_squawk+ method:
# vendor/plugins/yaffle/lib/yaffle/core_ext.rb
-
+
String.class_eval do
def to_squawk
"squawk! #{self}".strip
diff --git a/railties/guides/source/rails_application_templates.textile b/railties/guides/source/rails_application_templates.textile
index 1bf9cfec33ffa..bc7b151dfef54 100644
--- a/railties/guides/source/rails_application_templates.textile
+++ b/railties/guides/source/rails_application_templates.textile
@@ -79,7 +79,7 @@ plugin 'authentication', :git => 'git://github.com/foor/bar.git'
You can even install plugins as git submodules :
-plugin 'authentication', :git => 'git://github.com/foor/bar.git',
+plugin 'authentication', :git => 'git://github.com/foor/bar.git',
:submodule => true
@@ -103,7 +103,7 @@ class Object
def not_nil?
!nil?
end
-
+
def not_blank?
!blank?
end
diff --git a/railties/guides/source/routing.textile b/railties/guides/source/routing.textile
index 625941ba31876..d92c66cfd29de 100644
--- a/railties/guides/source/routing.textile
+++ b/railties/guides/source/routing.textile
@@ -501,7 +501,7 @@ class BlacklistConstraint
end
TwitterClone::Application.routes.draw do
- match "*path" => "blacklist#index",
+ match "*path" => "blacklist#index",
:constraints => BlacklistConstraint.new
end
@@ -765,7 +765,7 @@ formatted_users GET /users.:format {:controller=>"users", :action=>"index"}
You may restrict the listing to the routes that map to a particular controller setting the +CONTROLLER+ environment variable:
-$ CONTROLLER=users rake routes
+$ CONTROLLER=users rake routes
TIP: You'll find that the output from +rake routes+ is much more readable if you widen your terminal window until the output lines don't wrap.
diff --git a/railties/guides/source/security.textile b/railties/guides/source/security.textile
index 6372c606b786b..4656cf4e4024c 100644
--- a/railties/guides/source/security.textile
+++ b/railties/guides/source/security.textile
@@ -401,7 +401,7 @@ Note that this vulnerability is not restricted to database columns. Any setter
class Child < ActiveRecord::Base
belongs_to :person
- end
+ end
As a result, the vulnerability is extended beyond simply exposing column assignment, allowing attackers the ability to create entirely new records in referenced tables (children in this case).
diff --git a/railties/guides/w3c_validator.rb b/railties/guides/w3c_validator.rb
index 4da48bf3fb49a..da5200c0b7bae 100644
--- a/railties/guides/w3c_validator.rb
+++ b/railties/guides/w3c_validator.rb
@@ -21,7 +21,7 @@
#
# Separate many using commas:
#
-# # validates only
+# # validates only
# ONLY=assoc,migrations rake validate_guides
#
# ---------------------------------------------------------------------------
@@ -32,13 +32,13 @@
module RailsGuides
class Validator
-
+
def validate
validator = MarkupValidator.new
STDOUT.sync = true
errors_on_guides = {}
- guides_to_validate.each do |f|
+ guides_to_validate.each do |f|
results = validator.validate_file(f)
if results.validity
@@ -48,10 +48,10 @@ def validate
errors_on_guides[f] = results.errors
end
end
-
+
show_results(errors_on_guides)
end
-
+
private
def guides_to_validate
guides = Dir["./guides/output/*.html"]
@@ -65,13 +65,13 @@ def select_only(guides)
prefixes.any? {|p| guide.start_with?("./guides/output/#{p}")}
end
end
-
+
def show_results(error_list)
if error_list.size == 0
puts "\n\nAll checked guides validate OK!"
else
error_summary = error_detail = ""
-
+
error_list.each_pair do |name, errors|
error_summary += "\n #{name}"
error_detail += "\n\n #{name} has #{errors.size} validation error(s):\n"
@@ -79,12 +79,12 @@ def show_results(error_list)
error_detail += "\n "+error.to_s.gsub("\n", "")
end
end
-
+
puts "\n\nThere are #{error_list.size} guides with validation errors:\n" + error_summary
puts "\nHere are the detailed errors for each guide:" + error_detail
end
end
-
+
end
end
diff --git a/railties/lib/rails/code_statistics.rb b/railties/lib/rails/code_statistics.rb
index 740d8a1767b5f..57e29a0045601 100644
--- a/railties/lib/rails/code_statistics.rb
+++ b/railties/lib/rails/code_statistics.rb
@@ -12,7 +12,7 @@ def to_s
print_header
@pairs.each { |pair| print_line(pair.first, @statistics[pair.first]) }
print_splitter
-
+
if @total
print_line("Total", @total)
print_splitter
@@ -29,7 +29,7 @@ def calculate_statistics
def calculate_directory_statistics(directory, pattern = /.*\.rb$/)
stats = { "lines" => 0, "codelines" => 0, "classes" => 0, "methods" => 0 }
- Dir.foreach(directory) do |file_name|
+ Dir.foreach(directory) do |file_name|
if File.stat(directory + "/" + file_name).directory? and (/^\./ !~ file_name)
newstats = calculate_directory_statistics(directory + "/" + file_name, pattern)
stats.each { |k, v| stats[k] += newstats[k] }
@@ -85,10 +85,10 @@ def print_line(name, statistics)
start = if TEST_TYPES.include? name
"| #{name.ljust(20)} "
else
- "| #{name.ljust(20)} "
+ "| #{name.ljust(20)} "
end
- puts start +
+ puts start +
"| #{statistics["lines"].to_s.rjust(5)} " +
"| #{statistics["codelines"].to_s.rjust(5)} " +
"| #{statistics["classes"].to_s.rjust(7)} " +
diff --git a/railties/lib/rails/generators/base.rb b/railties/lib/rails/generators/base.rb
index fdfceb14ce816..f97f3db58859a 100644
--- a/railties/lib/rails/generators/base.rb
+++ b/railties/lib/rails/generators/base.rb
@@ -81,7 +81,7 @@ def self.namespace(name=nil)
# guessed based on class invokes hook_for, as noticed in the example above.
# This can be customized with two options: :base and :as.
#
- # Let's suppose you are creating a generator that needs to invoke the
+ # Let's suppose you are creating a generator that needs to invoke the
# controller generator from test unit. Your first attempt is:
#
# class AwesomeGenerator < Rails::Generators::Base
diff --git a/railties/lib/rails/generators/rails/app/templates/public/javascripts/effects.js b/railties/lib/rails/generators/rails/app/templates/public/javascripts/effects.js
index 066ee5909ce7f..c81e6c7d5f4bb 100644
--- a/railties/lib/rails/generators/rails/app/templates/public/javascripts/effects.js
+++ b/railties/lib/rails/generators/rails/app/templates/public/javascripts/effects.js
@@ -150,7 +150,7 @@ var Effect = {
toggle: function(element, effect, options) {
element = $(element);
effect = (effect || 'appear').toLowerCase();
-
+
return Effect[ Effect.PAIRS[ effect ][ element.visible() ? 1 : 0 ] ](element, Object.extend({
queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
}, options || {}));
diff --git a/railties/lib/rails/generators/rails/generator/USAGE b/railties/lib/rails/generators/rails/generator/USAGE
index d8c3f7f634710..d68539e4a66e5 100644
--- a/railties/lib/rails/generators/rails/generator/USAGE
+++ b/railties/lib/rails/generators/rails/generator/USAGE
@@ -1,6 +1,6 @@
Description:
Stubs out a new generator at lib/generators. Pass the generator name, either
- CamelCased or under_scored, as an argument.
+ CamelCased or under_scored, as an argument.
Example:
`rails generate generator Awesome`
diff --git a/railties/lib/rails/generators/rails/migration/USAGE b/railties/lib/rails/generators/rails/migration/USAGE
index d21c81b760d3e..af74963b0107c 100644
--- a/railties/lib/rails/generators/rails/migration/USAGE
+++ b/railties/lib/rails/generators/rails/migration/USAGE
@@ -18,12 +18,12 @@ Example:
This will create the AddTitleBodyToPost in db/migrate/20080514090912_add_title_body_to_post.rb with
this in the Up migration:
- add_column :posts, :title, :string
- add_column :posts, :body, :text
+ add_column :posts, :title, :string
+ add_column :posts, :body, :text
add_column :posts, :published, :boolean
And this in the Down migration:
- remove_column :posts, :published
- remove_column :posts, :body
+ remove_column :posts, :published
+ remove_column :posts, :body
remove_column :posts, :title
diff --git a/railties/lib/rails/generators/rails/plugin/USAGE b/railties/lib/rails/generators/rails/plugin/USAGE
index 00a429c58584a..1bcfcf190dae3 100644
--- a/railties/lib/rails/generators/rails/plugin/USAGE
+++ b/railties/lib/rails/generators/rails/plugin/USAGE
@@ -1,6 +1,6 @@
Description:
Stubs out a new plugin at vendor/plugins. Pass the plugin name, either
- CamelCased or under_scored, as an argument.
+ CamelCased or under_scored, as an argument.
Example:
`rails generate plugin BrowserFilters`
diff --git a/railties/lib/rails/generators/rails/resource/resource_generator.rb b/railties/lib/rails/generators/rails/resource/resource_generator.rb
index fc070026d6a47..8a943013d3714 100644
--- a/railties/lib/rails/generators/rails/resource/resource_generator.rb
+++ b/railties/lib/rails/generators/rails/resource/resource_generator.rb
@@ -16,9 +16,9 @@ class ResourceGenerator < ModelGenerator #metagenerator
def add_resource_route
return if options[:actions].present?
- route_config = class_path.collect{|namespace| "namespace :#{namespace} do " }.join(" ")
+ route_config = class_path.collect{|namespace| "namespace :#{namespace} do " }.join(" ")
route_config << "resources :#{file_name.pluralize}"
- route_config << " end" * class_path.size
+ route_config << " end" * class_path.size
route route_config
end
end
diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb
index be229cc9a207a..8d5132a5ca209 100644
--- a/railties/lib/rails/plugin.rb
+++ b/railties/lib/rails/plugin.rb
@@ -16,7 +16,7 @@ module Rails
# Besides this conceptual difference, the only difference between Rails::Engine and
# Rails::Plugin is that plugins automatically load the file "init.rb" at the plugin
# root during the boot process.
- #
+ #
class Plugin < Engine
def self.inherited(base)
raise "You cannot inherit from Rails::Plugin"
diff --git a/railties/lib/rails/railtie.rb b/railties/lib/rails/railtie.rb
index 8a6e2716dc76b..2684552701ef3 100644
--- a/railties/lib/rails/railtie.rb
+++ b/railties/lib/rails/railtie.rb
@@ -48,7 +48,7 @@ module Rails
# # lib/my_gem/railtie.rb
# require 'my_gem'
# require 'rails'
- #
+ #
# module MyGem
# class Railtie < Rails::Railtie
# end
@@ -121,7 +121,7 @@ module Rails
# described here can be used in all three.
#
# Be sure to look at the documentation of those specific classes for more information.
- #
+ #
class Railtie
autoload :Configurable, "rails/railtie/configurable"
autoload :Configuration, "rails/railtie/configuration"
diff --git a/railties/lib/rails/script_rails_loader.rb b/railties/lib/rails/script_rails_loader.rb
index 91672e5d81dcb..705408961498f 100644
--- a/railties/lib/rails/script_rails_loader.rb
+++ b/railties/lib/rails/script_rails_loader.rb
@@ -17,11 +17,11 @@ def self.exec_script_rails!
rescue SystemCallError
# could not chdir, no problem just return
end
-
+
def self.in_rails_application?
File.exists?(SCRIPT_RAILS)
end
-
+
def self.in_rails_application_subdirectory?(path = Pathname.new(Dir.pwd))
File.exists?(File.join(path, SCRIPT_RAILS)) || !path.root? && in_rails_application_subdirectory?(path.parent)
end
diff --git a/railties/lib/rails/tasks/documentation.rake b/railties/lib/rails/tasks/documentation.rake
index c1b1a41d48e12..7aefbb49b08c7 100644
--- a/railties/lib/rails/tasks/documentation.rake
+++ b/railties/lib/rails/tasks/documentation.rake
@@ -4,15 +4,15 @@ require 'rake/rdoctask'
class RDocTaskWithoutDescriptions < Rake::RDocTask
def define
task rdoc_task_name
-
+
task rerdoc_task_name => [clobber_task_name, rdoc_task_name]
-
+
task clobber_task_name do
rm_r rdoc_dir rescue nil
end
-
+
task :clobber => [clobber_task_name]
-
+
directory @rdoc_dir
task rdoc_task_name => [rdoc_target]
file rdoc_target => @rdoc_files + [Rake.application.rakefile] do
diff --git a/railties/test/application/loading_test.rb b/railties/test/application/loading_test.rb
index 340ce675112ae..ecf7904c391d6 100644
--- a/railties/test/application/loading_test.rb
+++ b/railties/test/application/loading_test.rb
@@ -18,10 +18,10 @@ class Post < ActiveRecord::Base
validates_acceptance_of :title, :accept => "omg"
end
MODEL
-
+
require "#{rails_root}/config/environment"
setup_ar!
-
+
p = Post.create(:title => 'omg')
assert_equal 1, Post.count
assert_equal 'omg', p.title
@@ -73,7 +73,7 @@ class Post < ActiveRecord::Base
end
protected
-
+
def setup_ar!
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
ActiveRecord::Migration.verbose = false
diff --git a/railties/test/application/rake_test.rb b/railties/test/application/rake_test.rb
index d6e100ffe3aa8..454c9511d8bf2 100644
--- a/railties/test/application/rake_test.rb
+++ b/railties/test/application/rake_test.rb
@@ -14,7 +14,7 @@ def test_gems_tasks_are_loaded_first_than_application_ones
app_file "lib/tasks/app.rake", <<-RUBY
$task_loaded = Rake::Task.task_defined?("db:create:all")
RUBY
-
+
require "#{app_path}/config/environment"
::Rails.application.load_tasks
assert $task_loaded
diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb
index 0472ca73a8a6d..f5473333ed94f 100644
--- a/railties/test/generators/actions_test.rb
+++ b/railties/test/generators/actions_test.rb
@@ -88,7 +88,7 @@ def test_gem_with_options_should_include_all_options_in_gemfile
assert_deprecated do
action :gem, 'thoughtbot-factory_girl', :require_as => 'factory_girl', :source => 'http://gems.github.com'
- end
+ end
assert_file 'Gemfile', /gem "mislav\-will\-paginate", :require => "will\-paginate"/
assert_file 'Gemfile', /source "http:\/\/gems\.github\.com"/
@@ -103,7 +103,7 @@ def test_gem_with_env_should_include_all_dependencies_in_gemfile
end
assert_deprecated do
- action :gem, 'rspec-rails', :only => %w(development test)
+ action :gem, 'rspec-rails', :only => %w(development test)
end
assert_file 'Gemfile', /gem "rspec", :group => \["development", "test"\]/
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index 08cfb585f9a9e..849c8001f4fa6 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -79,7 +79,7 @@ def test_name_collision_raises_an_error
reserved_words = %w[application destroy plugin runner test]
reserved_words.each do |reserved|
content = capture(:stderr){ run_generator [File.join(destination_root, reserved)] }
- assert_equal "Invalid application name #{reserved}. Please give a name which does not match one of the reserved rails words.\n", content
+ assert_equal "Invalid application name #{reserved}. Please give a name which does not match one of the reserved rails words.\n", content
end
end
diff --git a/railties/test/railties/railtie_test.rb b/railties/test/railties/railtie_test.rb
index db0fd874917e6..6715003d3d193 100644
--- a/railties/test/railties/railtie_test.rb
+++ b/railties/test/railties/railtie_test.rb
@@ -132,7 +132,7 @@ class MyTie < Rails::Railtie
require "#{app_path}/config/environment"
assert $ran_block
end
-
+
test "we can change our environment if we want to" do
begin
original_env = Rails.env
diff --git a/railties/test/script_rails_loader_test.rb b/railties/test/script_rails_loader_test.rb
index 2a87e5cb58b13..3ccc147749037 100644
--- a/railties/test/script_rails_loader_test.rb
+++ b/railties/test/script_rails_loader_test.rb
@@ -2,21 +2,21 @@
require 'rails/script_rails_loader'
class ScriptRailsLoaderTest < ActiveSupport::TestCase
-
+
test "is in a rails application if script/rails exists" do
File.stubs(:exists?).returns(true)
assert Rails::ScriptRailsLoader.in_rails_application?
end
-
+
test "is in a rails application if parent directory has script/rails" do
File.stubs(:exists?).with("/foo/bar/script/rails").returns(false)
File.stubs(:exists?).with("/foo/script/rails").returns(true)
assert Rails::ScriptRailsLoader.in_rails_application_subdirectory?(Pathname.new("/foo/bar"))
end
-
+
test "is not in a rails application if at the root directory and doesn't have script/rails" do
Pathname.any_instance.stubs(:root?).returns true
assert !Rails::ScriptRailsLoader.in_rails_application?
end
-
+
end
\ No newline at end of file