mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
deleting trailing whitespaces
This commit is contained in:
@@ -248,7 +248,7 @@ It is possible to send email to one or more recipients in one email (for e.g. in
|
||||
class AdminMailer < ActionMailer::Base
|
||||
default :to => Admin.all.map(&:email).join(", "),
|
||||
:from => "notification@example.com"
|
||||
|
||||
|
||||
def new_registration(user)
|
||||
@user = user
|
||||
mail(:subject => "New User Signup: #{@user.email}")
|
||||
|
||||
@@ -3389,12 +3389,12 @@ Modifies the datetime format output by the formatter class associated with this
|
||||
<ruby>
|
||||
class Logger::FormatWithTime < Logger::Formatter
|
||||
cattr_accessor(:datetime_format) { "%Y%m%d%H%m%S" }
|
||||
|
||||
|
||||
def self.call(severity, timestamp, progname, msg)
|
||||
"#{timestamp.strftime(datetime_format)} -- #{String === msg ? msg : msg.inspect}\n"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
logger = Logger.new("log/development.log")
|
||||
logger.formatter = Logger::FormatWithTime
|
||||
logger.info("<- is the current time")
|
||||
|
||||
@@ -276,11 +276,11 @@ h4. Configuring Action Dispatch
|
||||
|
||||
* +config.action_dispatch.tld_length+ sets the TLD (top-level domain) length for the application. Defaults to +1+.
|
||||
|
||||
* +ActionDispatch::Callbacks.before+ takes a block of code to run before the request.
|
||||
* +ActionDispatch::Callbacks.before+ takes a block of code to run before the request.
|
||||
|
||||
* +ActionDispatch::Callbacks.to_prepare+ takes a block to run after +ActionDispatch::Callbacks.before+, but before the request. Runs for every request in +development+ mode, but only once for +production+ or environments with +cache_classes+ set to +true+.
|
||||
|
||||
* +ActionDispatch::Callbacks.after+ takes a block of code to run after the request.
|
||||
* +ActionDispatch::Callbacks.after+ takes a block of code to run after the request.
|
||||
|
||||
h4. Configuring Action View
|
||||
|
||||
@@ -396,7 +396,7 @@ Rails has 5 initialization events which can be hooked into (listed in order that
|
||||
|
||||
* +before_initialize+: This is run directly before the initialization process of the application occurs with the +:bootstrap_hook+ initializer near the beginning of the Rails initialization process.
|
||||
|
||||
* +to_prepare+: Run after the initializers are ran for all Railties (including the application itself), but before eager loading and the middleware stack is built.
|
||||
* +to_prepare+: Run after the initializers are ran for all Railties (including the application itself), but before eager loading and the middleware stack is built.
|
||||
|
||||
* +before_eager_load+: This is run directly before eager loading occurs, which is the default behaviour for the _production_ environment and not for the +development+ enviroment.
|
||||
|
||||
@@ -415,7 +415,7 @@ initializer "active_support.initialize_whiny_nils" do |app|
|
||||
end
|
||||
</ruby>
|
||||
|
||||
The +initializer+ method takes three arguments with the first being the name for the initializer and the second being an options hash (not shown here) and the third being a block. The +:before+ key in the options hash can be specified to specify which initializer this new initializer must run before, and the +:after+ key will specify which initializer to run this initializer _after_.
|
||||
The +initializer+ method takes three arguments with the first being the name for the initializer and the second being an options hash (not shown here) and the third being a block. The +:before+ key in the options hash can be specified to specify which initializer this new initializer must run before, and the +:after+ key will specify which initializer to run this initializer _after_.
|
||||
|
||||
Initializers defined using the +initializer+ method will be ran in the order they are defined in, with the exception of ones that use the +:before+ or +:after+ methods.
|
||||
|
||||
|
||||
@@ -644,7 +644,7 @@ Fundamentally HTML forms don't know about any sort of structured data, all they
|
||||
TIP: You may find you can try out examples in this section faster by using the console to directly invoke Rails' parameter parser. For example,
|
||||
|
||||
<ruby>
|
||||
ActionController::UrlEncodedPairParser.parse_query_parameters "name=fred&phone=0123456789"
|
||||
ActionController::UrlEncodedPairParser.parse_query_parameters "name=fred&phone=0123456789"
|
||||
# => {"name"=>"fred", "phone"=>"0123456789"}
|
||||
</ruby>
|
||||
|
||||
|
||||
@@ -403,7 +403,7 @@ Whilst the final section of this guide doesn't cover how to generate the most aw
|
||||
|
||||
h3. Generator methods
|
||||
|
||||
The following are methods available for both generators and templates for Rails.
|
||||
The following are methods available for both generators and templates for Rails.
|
||||
|
||||
NOTE: Methods provided by Thor are not covered this guide and can be found in "Thor's documentation":http://rdoc.info/github/wycats/thor/master/Thor/Actions.html
|
||||
|
||||
@@ -546,7 +546,7 @@ This method also takes a block:
|
||||
%Q{
|
||||
task :rock => :environment do
|
||||
puts "Rockin'"
|
||||
end
|
||||
end
|
||||
}
|
||||
end
|
||||
</ruby>
|
||||
|
||||
@@ -161,7 +161,7 @@ Ruby on Rails Guides
|
||||
<%= guide('API Documentation Guidelines', 'api_documentation_guidelines.html') do %>
|
||||
<p>This guide documents the Ruby on Rails API documentation guidelines.</p>
|
||||
<% end %>
|
||||
|
||||
|
||||
<%= guide('Ruby on Rails Guides Guidelines', 'ruby_on_rails_guides_guidelines.html') do %>
|
||||
<p>This guide documents the Ruby on Rails guides guidelines.</p>
|
||||
<% end %>
|
||||
|
||||
@@ -31,7 +31,7 @@ The actual +rails+ command is kept in _bin/rails_ at the and goes like this:
|
||||
end
|
||||
</ruby>
|
||||
|
||||
This file will attempt to load +rails/cli+ and if it cannot find it then add the +railties/lib+ path to the load path (+$:+) and will then try to require it again.
|
||||
This file will attempt to load +rails/cli+ and if it cannot find it then add the +railties/lib+ path to the load path (+$:+) and will then try to require it again.
|
||||
|
||||
h4. +railites/lib/rails/cli.rb+
|
||||
|
||||
@@ -120,7 +120,7 @@ This climbs the directory tree until it reaches a path which contains a +script/
|
||||
|
||||
This is effectively the same as doing +ruby script/rails [arguments]+. Where +[arguments]+ at this point in time is simply "server".
|
||||
|
||||
h4. +script/rails+
|
||||
h4. +script/rails+
|
||||
|
||||
This file looks like this:
|
||||
|
||||
@@ -236,7 +236,7 @@ Now back to +action_pack/lib/action_dispatch.rb+. The next +require+ in this fil
|
||||
|
||||
After this line, there's a require to +active_model+ which simply defines autoloads for the +ActiveModel+ part of Rails and sets up the +ActiveModel+ module which is used later on.
|
||||
|
||||
The last of the requires is to +rack+, which like the +active_model+ and +active_support+ requires before it, sets up the +Rack+ module as well as the autoloads for constants within it.
|
||||
The last of the requires is to +rack+, which like the +active_model+ and +active_support+ requires before it, sets up the +Rack+ module as well as the autoloads for constants within it.
|
||||
|
||||
Finally in +action_dispatch.rb+ the +ActionDispatch+ module and *its* autoloads are declared.
|
||||
|
||||
@@ -337,7 +337,7 @@ The class *is* defined in +Rack::Server+, but is overwritten in +Rails::Server+
|
||||
...
|
||||
</ruby>
|
||||
|
||||
This method will set up keys for the +options+ which Rails will then be able to use to determine how its server should run. After +initialize+ has finished, then the +start+ method will launch the server.
|
||||
This method will set up keys for the +options+ which Rails will then be able to use to determine how its server should run. After +initialize+ has finished, then the +start+ method will launch the server.
|
||||
|
||||
h4. +Rails::Server#start+
|
||||
|
||||
@@ -448,7 +448,7 @@ This file begins with requiring +config/application.rb+.
|
||||
|
||||
h4. +config/application.rb+
|
||||
|
||||
This file requires +config/boot.rb+, but only if it hasn't been required before, which would be the case in +rails server+ but *wouldn't* be the case with Passenger.
|
||||
This file requires +config/boot.rb+, but only if it hasn't been required before, which would be the case in +rails server+ but *wouldn't* be the case with Passenger.
|
||||
|
||||
Then the fun begins! The next line is:
|
||||
|
||||
@@ -512,7 +512,7 @@ For more information see the "Extensions to Logger":http://guides.rubyonrails.or
|
||||
|
||||
h4. +railties/lib/rails/application.rb+
|
||||
|
||||
The next file required by +railties/lib/rails.rb+ is +application.rb+. This file defines the +Rails::Application+ constant which the application's class defined in +config/application.rb+ in a standard Rails application depends on. Before the +Rails::Application+ class is defined however, there's some other files that get required first.
|
||||
The next file required by +railties/lib/rails.rb+ is +application.rb+. This file defines the +Rails::Application+ constant which the application's class defined in +config/application.rb+ in a standard Rails application depends on. Before the +Rails::Application+ class is defined however, there's some other files that get required first.
|
||||
|
||||
The first of these is +active_support/core_ext/hash/reverse_merge+ which can be "read about in the Active Support Core Extensions guide":http://guides.rubyonrails.org/active_support_core_extensions.html#merging under the "Merging" section.
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
<div class="wrapper">
|
||||
<div id="mainCol">
|
||||
<%= yield.html_safe %>
|
||||
|
||||
|
||||
<h3>Feedback</h3>
|
||||
<p>
|
||||
You're encouraged to help in keeping the quality of this guide.
|
||||
|
||||
@@ -48,7 +48,7 @@ To generate all the guides just cd into the +railties+ directory and execute
|
||||
rake generate_guides
|
||||
</plain>
|
||||
|
||||
You'll need the gems erubis, i18n, and RedCloth.
|
||||
You'll need the gems erubis, i18n, and RedCloth.
|
||||
|
||||
To process +my_guide.textile+ and nothing else use the +ONLY+ environment variable:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user