aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
Diffstat (limited to 'railties')
-rw-r--r--railties/Rakefile3
-rw-r--r--railties/doc/guides/html/actioncontroller_basics.html10
-rw-r--r--railties/doc/guides/html/association_basics.html32
-rw-r--r--railties/doc/guides/html/benchmarking_and_profiling.html2
-rw-r--r--railties/doc/guides/html/creating_plugins.html4
-rw-r--r--railties/doc/guides/html/debugging_rails_applications.html18
-rw-r--r--railties/doc/guides/html/finders.html141
-rw-r--r--railties/doc/guides/html/form_helpers.html18
-rw-r--r--railties/doc/guides/html/getting_started_with_rails.html28
-rw-r--r--railties/doc/guides/html/index.html22
-rw-r--r--railties/doc/guides/html/layouts_and_rendering.html26
-rw-r--r--railties/doc/guides/html/migrations.html6
-rw-r--r--railties/doc/guides/html/routing_outside_in.html34
-rw-r--r--railties/doc/guides/html/testing_rails_applications.html10
-rw-r--r--railties/doc/guides/source/finders.txt85
-rw-r--r--railties/doc/guides/source/images/icons/README (renamed from railties/doc/guides/source/icons/README)0
-rw-r--r--railties/doc/guides/source/images/icons/callouts/1.png (renamed from railties/doc/guides/source/icons/callouts/1.png)bin329 -> 329 bytes
-rw-r--r--railties/doc/guides/source/images/icons/callouts/10.png (renamed from railties/doc/guides/source/icons/callouts/10.png)bin361 -> 361 bytes
-rw-r--r--railties/doc/guides/source/images/icons/callouts/11.png (renamed from railties/doc/guides/source/icons/callouts/11.png)bin565 -> 565 bytes
-rw-r--r--railties/doc/guides/source/images/icons/callouts/12.png (renamed from railties/doc/guides/source/icons/callouts/12.png)bin617 -> 617 bytes
-rw-r--r--railties/doc/guides/source/images/icons/callouts/13.png (renamed from railties/doc/guides/source/icons/callouts/13.png)bin623 -> 623 bytes
-rw-r--r--railties/doc/guides/source/images/icons/callouts/14.png (renamed from railties/doc/guides/source/icons/callouts/14.png)bin411 -> 411 bytes
-rw-r--r--railties/doc/guides/source/images/icons/callouts/15.png (renamed from railties/doc/guides/source/icons/callouts/15.png)bin640 -> 640 bytes
-rw-r--r--railties/doc/guides/source/images/icons/callouts/2.png (renamed from railties/doc/guides/source/icons/callouts/2.png)bin353 -> 353 bytes
-rw-r--r--railties/doc/guides/source/images/icons/callouts/3.png (renamed from railties/doc/guides/source/icons/callouts/3.png)bin350 -> 350 bytes
-rw-r--r--railties/doc/guides/source/images/icons/callouts/4.png (renamed from railties/doc/guides/source/icons/callouts/4.png)bin345 -> 345 bytes
-rw-r--r--railties/doc/guides/source/images/icons/callouts/5.png (renamed from railties/doc/guides/source/icons/callouts/5.png)bin348 -> 348 bytes
-rw-r--r--railties/doc/guides/source/images/icons/callouts/6.png (renamed from railties/doc/guides/source/icons/callouts/6.png)bin355 -> 355 bytes
-rw-r--r--railties/doc/guides/source/images/icons/callouts/7.png (renamed from railties/doc/guides/source/icons/callouts/7.png)bin344 -> 344 bytes
-rw-r--r--railties/doc/guides/source/images/icons/callouts/8.png (renamed from railties/doc/guides/source/icons/callouts/8.png)bin357 -> 357 bytes
-rw-r--r--railties/doc/guides/source/images/icons/callouts/9.png (renamed from railties/doc/guides/source/icons/callouts/9.png)bin357 -> 357 bytes
-rw-r--r--railties/doc/guides/source/images/icons/caution.png (renamed from railties/doc/guides/source/icons/caution.png)bin2554 -> 2554 bytes
-rw-r--r--railties/doc/guides/source/images/icons/example.png (renamed from railties/doc/guides/source/icons/example.png)bin2354 -> 2354 bytes
-rw-r--r--railties/doc/guides/source/images/icons/home.png (renamed from railties/doc/guides/source/icons/home.png)bin1340 -> 1340 bytes
-rw-r--r--railties/doc/guides/source/images/icons/important.png (renamed from railties/doc/guides/source/icons/important.png)bin2657 -> 2657 bytes
-rw-r--r--railties/doc/guides/source/images/icons/next.png (renamed from railties/doc/guides/source/icons/next.png)bin1302 -> 1302 bytes
-rw-r--r--railties/doc/guides/source/images/icons/note.png (renamed from railties/doc/guides/source/icons/note.png)bin2730 -> 2730 bytes
-rw-r--r--railties/doc/guides/source/images/icons/prev.png (renamed from railties/doc/guides/source/icons/prev.png)bin1348 -> 1348 bytes
-rw-r--r--railties/doc/guides/source/images/icons/tip.png (renamed from railties/doc/guides/source/icons/tip.png)bin2602 -> 2602 bytes
-rw-r--r--railties/doc/guides/source/images/icons/up.png (renamed from railties/doc/guides/source/icons/up.png)bin1320 -> 1320 bytes
-rw-r--r--railties/doc/guides/source/images/icons/warning.png (renamed from railties/doc/guides/source/icons/warning.png)bin2828 -> 2828 bytes
-rw-r--r--railties/lib/tasks/documentation.rake2
42 files changed, 304 insertions, 137 deletions
diff --git a/railties/Rakefile b/railties/Rakefile
index 59cbcf2322..5100b4bd9b 100644
--- a/railties/Rakefile
+++ b/railties/Rakefile
@@ -282,7 +282,6 @@ task :guides do
FileUtils.mkdir(html)
template = File.expand_path("doc/guides/source/templates/guides.html.erb")
- icons = File.expand_path("doc/guides/source/icons")
ignore = ['icons', 'images', 'templates', 'stylesheets']
ignore << 'active_record_basics.txt'
@@ -303,7 +302,7 @@ task :guides do
begin
puts "GENERATING => #{output}"
ENV['MANUALSONRAILS_TOC'] = 'no' if indexless.include?(entry)
- Mizuho::Generator.new(input, output, template, false, icons).start
+ Mizuho::Generator.new(input, output, template).start
rescue Mizuho::GenerationError
STDERR.puts "*** ERROR"
exit 2
diff --git a/railties/doc/guides/html/actioncontroller_basics.html b/railties/doc/guides/html/actioncontroller_basics.html
index 091abfe3c7..9bba0d301a 100644
--- a/railties/doc/guides/html/actioncontroller_basics.html
+++ b/railties/doc/guides/html/actioncontroller_basics.html
@@ -465,7 +465,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">There are two <tt>session</tt> methods, the class and the instance method. The class method which is described above is used to turn the session on and off while the instance method described below is used to access session values. The class method is used outside of method definitions while the instance methods is used inside methods, in actions or filters.</td>
</tr></table>
@@ -974,7 +974,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/warning.png" alt="Warning" />
+<img src="./images/icons/warning.png" alt="Warning" />
</td>
<td class="content">Be careful when using (or just don't use) "outside" data (params, cookies, etc) to locate the file on disk, as this is a security risk as someone could gain access to files they are not meant to have access to.</td>
</tr></table>
@@ -982,7 +982,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">It is not recommended that you stream static files through Rails if you can instead keep them in a public folder on your web server. It is much more efficient to let the user download the file directly using Apache or another web server, keeping the request from unnecessarily going through the whole Rails stack.</td>
</tr></table>
@@ -1019,7 +1019,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">Configuration files are not reloaded on each request, so you have to restart the server in order for their changes to take effect.</td>
</tr></table>
@@ -1112,7 +1112,7 @@ private
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">Certain exceptions are only rescuable from the ApplicationController class, as they are raised before the controller gets initialized and the action gets executed. See Pratik Naik's <a href="http://m.onkey.org/2008/7/20/rescue-from-dispatching">article</a> on the subject for more information.</td>
</tr></table>
diff --git a/railties/doc/guides/html/association_basics.html b/railties/doc/guides/html/association_basics.html
index de84551aef..012a1a0156 100644
--- a/railties/doc/guides/html/association_basics.html
+++ b/railties/doc/guides/html/association_basics.html
@@ -433,7 +433,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">The name of the other model is pluralized when declaring a <tt>has_many</tt> association.</td>
</tr></table>
@@ -573,7 +573,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">Using <tt>t.integer :supplier_id</tt> makes the foreign key naming obvious and implicit. In current versions of Rails, you can abstract away this implementation detail by using <tt>t.references :supplier</tt> instead.</td>
</tr></table>
@@ -777,7 +777,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/warning.png" alt="Warning" />
+<img src="./images/icons/warning.png" alt="Warning" />
</td>
<td class="content">The precedence between model names is calculated using the <tt>&lt;</tt> operator for <tt>String</tt>. This means that if the strings are of different lengths, and the strings are equal when compared up to the shortest length, then the longer string is considered of higher lexical precedence than the shorter one. For example, one would expect the tables "paper_boxes" and "papers" to generate a join table name of "papers_paper_boxes" because of the length of the name "paper_boxes", but it in fact generates a join table name of "paper_boxes_papers".</td>
</tr></table>
@@ -1112,7 +1112,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/warning.png" alt="Warning" />
+<img src="./images/icons/warning.png" alt="Warning" />
</td>
<td class="content">You should not specify this option on a <tt>belongs_to</tt> association that is connected with a <tt>has_many</tt> association on the other class. Doing so can lead to orphaned records in your database.</td>
</tr></table>
@@ -1131,7 +1131,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">In any case, Rails will not create foreign key columns for you. You need to explicitly define them as part of your migrations.</td>
</tr></table>
@@ -1174,7 +1174,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">There's no need to use <tt>:include</tt> for immediate associations - that is, if you have <tt>Order belongs_to :customer</tt>, then the customer is eager-loaded automatically when it's needed.</td>
</tr></table>
@@ -1414,7 +1414,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">In any case, Rails will not create foreign key columns for you. You need to explicitly define them as part of your migrations.</td>
</tr></table>
@@ -1606,7 +1606,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/warning.png" alt="Warning" />
+<img src="./images/icons/warning.png" alt="Warning" />
</td>
<td class="content">Objects will be in addition destroyed if they're associated with <tt>:dependent &#8658; :destroy</tt>, and deleted if they're associated with <tt>:dependent &#8658; :delete_all</tt>.</td>
</tr></table>
@@ -1834,7 +1834,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">If you specify <tt>:finder_sql</tt> but not <tt>:counter_sql</tt>, then the counter SQL will be generated by substituting <tt>SELECT COUNT(*) FROM</tt> for the <tt>SELECT &#8230; FROM</tt> clause of your <tt>:finder_sql</tt> statement.</td>
</tr></table>
@@ -1844,7 +1844,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">This option is ignored when you use the <tt>:through</tt> option on the association.</td>
</tr></table>
@@ -1867,7 +1867,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">In any case, Rails will not create foreign key columns for you. You need to explicitly define them as part of your migrations.</td>
</tr></table>
@@ -1951,7 +1951,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/warning.png" alt="Warning" />
+<img src="./images/icons/warning.png" alt="Warning" />
</td>
<td class="content">If you specify your own <tt>:select</tt>, be sure to include the primary key and foreign key columns of the associated model. If you do not, Rails will throw an error.</td>
</tr></table>
@@ -2077,7 +2077,7 @@ assemblies<span style="color: #990000">.</span>create<span style="color: #990000
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/warning.png" alt="Warning" />
+<img src="./images/icons/warning.png" alt="Warning" />
</td>
<td class="content">The use of extra attributes on the join table in a <tt>has_and_belongs_to_many</tt> association is deprecated. If you require this sort of complex behavior on the table that joins two models in a many-to-many relationship, you should use a <tt>has_many :through</tt> association instead of <tt>has_and_belongs_to_many</tt>.</td>
</tr></table>
@@ -2103,7 +2103,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">This method is aliased as <tt><em>collection</em>.concat</tt> and <tt><em>collection</em>.push</tt>.</td>
</tr></table>
@@ -2296,7 +2296,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">The <tt>:foreign_key</tt> and <tt>:association_foreign_key</tt> options are useful when setting up a many-to-many self-join. For example:</td>
</tr></table>
@@ -2349,7 +2349,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">If you specify <tt>:finder_sql</tt> but not <tt>:counter_sql</tt>, then the counter SQL will be generated by substituting <tt>SELECT COUNT(*) FROM</tt> for the <tt>SELECT &#8230; FROM</tt> clause of your <tt>:finder_sql</tt> statement.</td>
</tr></table>
diff --git a/railties/doc/guides/html/benchmarking_and_profiling.html b/railties/doc/guides/html/benchmarking_and_profiling.html
index ab036f00b1..0a2c995580 100644
--- a/railties/doc/guides/html/benchmarking_and_profiling.html
+++ b/railties/doc/guides/html/benchmarking_and_profiling.html
@@ -578,7 +578,7 @@ Tree File - A file output that can be use in conjunction with KCachegrind to vis
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">KCachegrind is Linux only. For Mac this means you have to do a full KDE install to have it working in your OS. Which is over 3 gigs in size. For windows there is clone called wincachegrind but it is no longer actively being developed.</td>
</tr></table>
diff --git a/railties/doc/guides/html/creating_plugins.html b/railties/doc/guides/html/creating_plugins.html
index 93fbe72a78..48d5f03687 100644
--- a/railties/doc/guides/html/creating_plugins.html
+++ b/railties/doc/guides/html/creating_plugins.html
@@ -390,7 +390,7 @@ script/server</tt></pre>
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">The aforementioned instructions will work for sqlite3. For more detailed instructions on how to create a rails app for other databases see the API docs.</td>
</tr></table>
@@ -438,7 +438,7 @@ create vendor/plugins/yaffle/generators/yaffle/USAGE</tt></pre>
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">
<div class="title">Editor's note:</div>Many plugin authors prefer to keep this file, and add all of the require statements in it. That way, they only line in init.rb would be <tt>require "yaffle"</tt>. If you are developing a plugin that has a lot of files in the lib directory, you may want to create a subdirectory like lib/yaffle and store your files in there. That way your init.rb file stays clean</td>
diff --git a/railties/doc/guides/html/debugging_rails_applications.html b/railties/doc/guides/html/debugging_rails_applications.html
index f29d8860d2..bf1e442d59 100644
--- a/railties/doc/guides/html/debugging_rails_applications.html
+++ b/railties/doc/guides/html/debugging_rails_applications.html
@@ -424,7 +424,7 @@ config<span style="color: #990000">.</span>logger <span style="color: #990000">=
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">By default, each log is created under <tt>RAILS_ROOT/log/</tt> and the log file name is <tt>environment_name.log</tt>.</td>
</tr></table>
@@ -444,7 +444,7 @@ ActiveRecord<span style="color: #990000">::</span>Base<span style="color: #99000
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">The default Rails log level is <tt>info</tt> in production mode and <tt>debug</tt> in development and test mode.</td>
</tr></table>
@@ -561,7 +561,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">In development mode, you can dynamically <tt>require 'ruby-debug'</tt> instead of restarting the server, if it was started without <tt>&#8212;debugger</tt>.</td>
</tr></table>
@@ -593,7 +593,7 @@ continue edit frame method putl set tmate where</tt></pre>
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">To view the help menu for any command use <tt>help &lt;command-name&gt;</tt> in active debug mode. For example: <em><tt>help var</tt></em></td>
</tr></table>
@@ -717,7 +717,7 @@ true</tt></pre>
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">You can also step into <strong>irb</strong> mode with the command <tt>irb</tt> (of course!). This way an irb session will be started within the context you invoked it. But be warned: this is an experimental feature.</td>
</tr></table>
@@ -748,7 +748,7 @@ true</tt></pre>
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">The commands <tt>p</tt> (print) and <tt>pp</tt> (pretty print) can be used to evaluate Ruby expressions and display the value of variables to the console.</td>
</tr></table>
@@ -766,7 +766,7 @@ true</tt></pre>
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">You can also use <tt>step+ <em>n</em></tt> and <tt>step- <em>n</em></tt> to move forward or backward <em>n</em> steps respectively.</td>
</tr></table>
@@ -796,7 +796,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">You can use ruby-debug while using script/console. Just remember to <tt>require "ruby-debug"</tt> before calling the <tt>debugger</tt> method.</td>
</tr></table>
@@ -962,7 +962,7 @@ No breakpoints.</tt></pre>
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">You can include any number of these configuration lines inside a <tt>.rdebugrc</tt> file in your HOME directory. ruby-debug will read this file every time it is loaded. and configure itself accordingly.</td>
</tr></table>
diff --git a/railties/doc/guides/html/finders.html b/railties/doc/guides/html/finders.html
index 75a922f397..b10d390105 100644
--- a/railties/doc/guides/html/finders.html
+++ b/railties/doc/guides/html/finders.html
@@ -258,12 +258,17 @@ ul#navMain {
<li><a href="#_count">Count</a></li>
+ <li><a href="#_average">Average</a></li>
+
+ <li><a href="#_minimum">Minimum</a></li>
+
+ <li><a href="#_maximum">Maximum</a></li>
+
+ <li><a href="#_sum">Sum</a></li>
+
</ul>
</li>
<li>
- <a href="#_with_scope">With Scope</a>
- </li>
- <li>
<a href="#_credits">Credits</a>
</li>
<li>
@@ -282,6 +287,8 @@ ul#navMain {
<li><a href="#_tuesday_21_october_2008">Tuesday, 21 October 2008</a></li>
+ <li><a href="#_wednesday_22_october_2008">Wednesday, 22 October 2008</a></li>
+
</ul>
</li>
</ol>
@@ -550,7 +557,23 @@ http://www.gnu.org/software/src-highlite -->
</div>
<h2 id="_group">9. Group</h2>
<div class="sectionbody">
-<div class="para"><p>TODO</p></div>
+<div class="para"><p>The group option for find is useful, for example, if you want to find a collection of the dates orders were created on. We could use the option in this context:</p></div>
+<div class="exampleblock">
+<div class="exampleblock-content"><!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>Order<span style="color: #990000">.</span>find<span style="color: #990000">(:</span>all<span style="color: #990000">,</span> <span style="color: #990000">:</span>group <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">"date(created_at)"</span><span style="color: #990000">,</span> <span style="color: #990000">:</span>order <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">"created_at"</span><span style="color: #990000">)</span>
+</tt></pre></div></div>
+<div class="para"><p>And this will give us a single Order object for each date that we have orders in our database.</p></div>
+<div class="para"><p>The SQL that would be executed would be something like this:</p></div>
+<div class="exampleblock">
+<div class="exampleblock-content"><!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">SELECT</span></span> <span style="color: #990000">*</span> <span style="font-weight: bold"><span style="color: #0000FF">FROM</span></span> <span style="color: #FF0000">`orders`</span> <span style="font-weight: bold"><span style="color: #0000FF">GROUP</span></span> <span style="font-weight: bold"><span style="color: #0000FF">BY</span></span> <span style="color: #009900">date</span><span style="color: #990000">(</span>created_at<span style="color: #990000">)</span>
+</tt></pre></div></div>
</div>
<h2 id="_read_only">10. Read Only</h2>
<div class="sectionbody">
@@ -577,7 +600,15 @@ client<span style="color: #990000">.</span>save
<div class="sectionbody">
<div class="para"><p>If you're wanting to stop race conditions for a specific record, say for example you're incrementing a single field for a record you can use the lock option to ensure that the record is updated correctly. It's recommended this be used inside a transaction.</p></div>
<div class="exampleblock">
-<div class="exampleblock-content"></div></div>
+<div class="exampleblock-content"><!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>Topic<span style="color: #990000">.</span>transaction <span style="font-weight: bold"><span style="color: #0000FF">do</span></span>
+ t <span style="color: #990000">=</span> Topic<span style="color: #990000">.</span>find<span style="color: #990000">(</span>params<span style="color: #990000">[:</span>id<span style="color: #990000">],</span> <span style="color: #990000">:</span>lock <span style="color: #990000">=&gt;</span> <span style="font-weight: bold"><span style="color: #0000FF">true</span></span><span style="color: #990000">)</span>
+ t<span style="color: #990000">.</span>increment!<span style="color: #990000">(:</span>views<span style="color: #990000">)</span>
+<span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
+</tt></pre></div></div>
</div>
<h2 id="_making_it_all_work_together">12. Making It All Work Together</h2>
<div class="sectionbody">
@@ -607,7 +638,12 @@ http://www.gnu.org/software/src-highlite -->
<div class="para"><p>This query is more efficent, but there's a gotcha. If you have a client who does not have an address or a mailing address they will not be returned in this query at all. If you have any association as an optional association, you may want to use include rather than joins.</p></div>
<div class="para"><p>When using eager loading you can specify conditions for the columns of the tables inside the eager loading to get back a smaller subset. If, for example, you want to find a client and all their orders within the last two weeks you could use eager loading with conditions for this:</p></div>
<div class="exampleblock">
-<div class="exampleblock-content"></div></div>
+<div class="exampleblock-content"><!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>Client<span style="color: #990000">.</span>find<span style="color: #990000">(:</span>first<span style="color: #990000">,</span> <span style="color: #990000">:</span><span style="font-weight: bold"><span style="color: #0000FF">include</span></span> <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">"orders"</span><span style="color: #990000">,</span> <span style="color: #990000">:</span>conditions <span style="color: #990000">=&gt;</span> <span style="color: #990000">[</span><span style="color: #FF0000">"orders.created_at &gt;= ? AND orders.created_at &lt;= ?"</span><span style="color: #990000">,</span> Time<span style="color: #990000">.</span>now <span style="color: #990000">-</span> <span style="color: #993399">2</span><span style="color: #990000">.</span>weeks<span style="color: #990000">,</span> Time<span style="color: #990000">.</span>now<span style="color: #990000">])</span>
+</tt></pre></div></div>
</div>
<h2 id="_dynamic_finders">14. Dynamic finders</h2>
<div class="sectionbody">
@@ -776,8 +812,7 @@ http://www.gnu.org/software/src-highlite -->
</div>
<h2 id="_calculations">19. Calculations</h2>
<div class="sectionbody">
-<h3 id="_count">19.1. Count</h3>
-<div class="para"><p>If you want to see how many records are in your models table you could call <tt>Client.count</tt> and that will return the number. If you want to be more specific and find all the clients with their age present in the database you can use <tt>Client.count(:age)</tt>.</p></div>
+<div class="para"><p>This section uses count as an example method in this preamble, but the options described apply to all sub-sections.</p></div>
<div class="para"><p><tt>count</tt> takes conditions much in the same way <tt>exists?</tt> does:</p></div>
<div class="exampleblock">
<div class="exampleblock-content"><!-- Generator: GNU source-highlight 2.9
@@ -786,6 +821,7 @@ http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>Client<span style="color: #990000">.</span>count<span style="color: #990000">(:</span>conditions <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">"first_name = 'Ryan'"</span><span style="color: #990000">)</span>
</tt></pre></div></div>
+<div class="para"><p>Which will execute:</p></div>
<div class="exampleblock">
<div class="exampleblock-content"><!-- Generator: GNU source-highlight 2.9
by Lorenzo Bettini
@@ -793,19 +829,76 @@ http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">SELECT</span></span> count<span style="color: #990000">(*)</span> <span style="font-weight: bold"><span style="color: #0000FF">AS</span></span> count_all <span style="font-weight: bold"><span style="color: #0000FF">FROM</span></span> <span style="color: #FF0000">`clients`</span> <span style="font-weight: bold"><span style="color: #0000FF">WHERE</span></span> <span style="color: #990000">(</span>first_name <span style="color: #990000">=</span> <span style="color: #993399">1</span><span style="color: #990000">)</span>
</tt></pre></div></div>
+<div class="para"><p>You can also use <tt>include</tt> or <tt>joins</tt> for this to do something a little more complex:</p></div>
+<div class="exampleblock">
+<div class="exampleblock-content"><!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>Client<span style="color: #990000">.</span>count<span style="color: #990000">(:</span>conditions <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">"clients.first_name = 'Ryan' AND orders.status = 'received'"</span><span style="color: #990000">,</span> <span style="color: #990000">:</span><span style="font-weight: bold"><span style="color: #0000FF">include</span></span> <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">"orders"</span><span style="color: #990000">)</span>
+</tt></pre></div></div>
+<div class="para"><p>Which will execute:</p></div>
+<div class="exampleblock">
+<div class="exampleblock-content"><!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">SELECT</span></span> count<span style="color: #990000">(</span><span style="font-weight: bold"><span style="color: #0000FF">DISTINCT</span></span> <span style="color: #FF0000">`clients`</span><span style="color: #990000">.</span>id<span style="color: #990000">)</span> <span style="font-weight: bold"><span style="color: #0000FF">AS</span></span> count_all <span style="font-weight: bold"><span style="color: #0000FF">FROM</span></span> <span style="color: #FF0000">`clients`</span> <span style="font-weight: bold"><span style="color: #0000FF">LEFT</span></span> <span style="font-weight: bold"><span style="color: #0000FF">OUTER</span></span> <span style="font-weight: bold"><span style="color: #0000FF">JOIN</span></span> <span style="color: #FF0000">`orders`</span> <span style="font-weight: bold"><span style="color: #0000FF">ON</span></span> orders<span style="color: #990000">.</span>client_id <span style="color: #990000">=</span> client<span style="color: #990000">.</span>id <span style="font-weight: bold"><span style="color: #0000FF">WHERE</span></span> <span style="color: #990000">(</span>clients<span style="color: #990000">.</span>first_name <span style="color: #990000">=</span> <span style="color: #FF0000">'name'</span> <span style="font-weight: bold"><span style="color: #0000FF">AND</span></span> orders<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #0000FF">status</span></span> <span style="color: #990000">=</span> <span style="color: #FF0000">'received'</span><span style="color: #990000">)</span>
+</tt></pre></div></div>
+<div class="para"><p>We specify <tt>clients.first_name</tt> just in case one of our join tables has a field also called <tt>first_name</tt> and we do <tt>orders.status</tt> because that's the name of our join table.</p></div>
+<h3 id="_count">19.1. Count</h3>
+<div class="para"><p>If you want to see how many records are in your model's table you could call <tt>Client.count</tt> and that will return the number. If you want to be more specific and find all the clients with their age present in the database you can use <tt>Client.count(:age)</tt>.</p></div>
+<div class="para"><p>For options, please see the parent section, Calculations.</p></div>
+<h3 id="_average">19.2. Average</h3>
+<div class="para"><p>If you want to see the average of a certain number in one of your tables you can call the <tt>average</tt> method on the class that relates to the table. This method call will look something like this:</p></div>
+<div class="exampleblock">
+<div class="exampleblock-content"><!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>Client<span style="color: #990000">.</span>average<span style="color: #990000">(</span><span style="color: #FF0000">"orders_count"</span><span style="color: #990000">)</span>
+</tt></pre></div></div>
+<div class="para"><p>This will return a number (possibly a floating point number such as 3.14159265) representing the average of the fields.</p></div>
+<div class="para"><p>For options, please see the parent section, <a href="#_calculations">Calculations</a></p></div>
+<h3 id="_minimum">19.3. Minimum</h3>
+<div class="para"><p>If you want to find the minimum value of a field in your table you can call the <tt>minimum</tt> method on the class that relates to the table. This method call will look something like this:</p></div>
+<div class="exampleblock">
+<div class="exampleblock-content"><!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>Client<span style="color: #990000">.</span>minimum<span style="color: #990000">(</span><span style="color: #FF0000">"age"</span><span style="color: #990000">)</span>
+</tt></pre></div></div>
+<div class="para"><p>For options, please see the parent section, <a href="#_calculations">Calculations</a></p></div>
+<h3 id="_maximum">19.4. Maximum</h3>
+<div class="para"><p>If you want to find the maximum value of a field in your table you can call the <tt>maximum</tt> method on the class that relates to the table. This method call will look something like this:</p></div>
+<div class="exampleblock">
+<div class="exampleblock-content"><!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>Client<span style="color: #990000">.</span>maximum<span style="color: #990000">(</span><span style="color: #FF0000">"age"</span><span style="color: #990000">)</span>
+</tt></pre></div></div>
+<div class="para"><p>For options, please see the parent section, <a href="#_calculations">Calculations</a></p></div>
+<h3 id="_sum">19.5. Sum</h3>
+<div class="para"><p>If you want to find the sum of a field for all records in your table you can call the <tt>sum</tt> method on the class that relates to the table. This method call will look something like this:</p></div>
+<div class="exampleblock">
+<div class="exampleblock-content"><!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>Client<span style="color: #990000">.</span>sum<span style="color: #990000">(</span><span style="color: #FF0000">"orders_count"</span><span style="color: #990000">)</span>
+</tt></pre></div></div>
+<div class="para"><p>For options, please see the parent section, <a href="#_calculations">Calculations</a></p></div>
</div>
-<h2 id="_with_scope">20. With Scope</h2>
-<div class="sectionbody">
-<div class="para"><p>TODO</p></div>
-</div>
-<h2 id="_credits">21. Credits</h2>
+<h2 id="_credits">20. Credits</h2>
<div class="sectionbody">
<div class="para"><p>Thanks to Ryan Bates for his awesome screencast on named scope #108. The information within the named scope section is intentionally similar to it, and without the cast may have not been possible.</p></div>
<div class="para"><p>Thanks to Mike Gunderloy for his tips on creating this guide.</p></div>
</div>
-<h2 id="_change_log">22. Change Log</h2>
+<h2 id="_change_log">21. Change Log</h2>
<div class="sectionbody">
-<h3 id="_sunday_28_september_2008">22.1. Sunday, 28 September 2008</h3>
+<h3 id="_sunday_28_september_2008">21.1. Sunday, 28 September 2008</h3>
<div class="olist"><ol>
<li>
<p>
@@ -833,7 +926,7 @@ Added finding by id and passing in ids to "IDs, First, Last and All"
</p>
</li>
</ol></div>
-<h3 id="_wednesday_01_october_2008">22.2. Wednesday, 01 October 2008</h3>
+<h3 id="_wednesday_01_october_2008">21.2. Wednesday, 01 October 2008</h3>
<div class="olist"><ol>
<li>
<p>
@@ -846,7 +939,7 @@ Altered formatting so it doesn't look bad.
</p>
</li>
</ol></div>
-<h3 id="_sunday_05_october_2008">22.3. Sunday, 05 October 2008</h3>
+<h3 id="_sunday_05_october_2008">21.3. Sunday, 05 October 2008</h3>
<div class="olist"><ol>
<li>
<p>
@@ -864,7 +957,7 @@ Added TODO sections.
</p>
</li>
</ol></div>
-<h3 id="_monday_06_october_2008">22.4. Monday, 06 October 2008</h3>
+<h3 id="_monday_06_october_2008">21.4. Monday, 06 October 2008</h3>
<div class="olist"><ol>
<li>
<p>
@@ -872,7 +965,7 @@ Added section in Eager Loading about using conditions on tables that are not the
</p>
</li>
</ol></div>
-<h3 id="_thursday_09_october_2008">22.5. Thursday, 09 October 2008</h3>
+<h3 id="_thursday_09_october_2008">21.5. Thursday, 09 October 2008</h3>
<div class="olist"><ol>
<li>
<p>
@@ -885,7 +978,7 @@ Added section on using count.
</p>
</li>
</ol></div>
-<h3 id="_tuesday_21_october_2008">22.6. Tuesday, 21 October 2008</h3>
+<h3 id="_tuesday_21_october_2008">21.6. Tuesday, 21 October 2008</h3>
<div class="olist"><ol>
<li>
<p>
@@ -893,6 +986,14 @@ Extended named scope guide by adding :include and :joins and find sub-sections.
</p>
</li>
</ol></div>
+<h3 id="_wednesday_22_october_2008">21.7. Wednesday, 22 October 2008</h3>
+<div class="olist"><ol>
+<li>
+<p>
+Completed calculations section.
+</p>
+</li>
+</ol></div>
</div>
</div>
diff --git a/railties/doc/guides/html/form_helpers.html b/railties/doc/guides/html/form_helpers.html
index da5307217c..28c317411b 100644
--- a/railties/doc/guides/html/form_helpers.html
+++ b/railties/doc/guides/html/form_helpers.html
@@ -259,7 +259,7 @@ Build complex, multi-model forms.
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">This guide is not intended to be a complete documentation of available form helpers and their arguments. Please visit <a href="http://api.rubyonrails.org/">the Rails API documentation</a> for a complete reference.</td>
</tr></table>
@@ -290,7 +290,7 @@ Build complex, multi-model forms.
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">Throughout this guide, this <tt>div</tt> with the hidden input will be stripped away to have clearer code samples.</td>
</tr></table>
@@ -322,7 +322,7 @@ a submit element.
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/important.png" alt="Important" />
+<img src="./images/icons/important.png" alt="Important" />
</td>
<td class="content">Always use "GET" as the method for search forms. Benefits are many: users are able to bookmark a specific search and get back to it; browsers cache results of "GET" requests, but not "POST"; and other.</td>
</tr></table>
@@ -340,7 +340,7 @@ a submit element.
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">
<div class="para"><p><tt>search_path</tt> can be a named route specified in "routes.rb":</p></div>
@@ -365,7 +365,7 @@ a submit element.
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">For every form input, an ID attribute is generated from its name ("q" in our example). These IDs can be very useful for CSS styling or manipulation of form controls with JavaScript.</td>
</tr></table>
@@ -390,7 +390,7 @@ a submit element.
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/warning.png" alt="Warning" />
+<img src="./images/icons/warning.png" alt="Warning" />
</td>
<td class="content">Do not delimit the second hash without doing so with the first hash, otherwise your method invocation will result in an ugly <tt>expecting tASSOC</tt> syntax error.</td>
</tr></table>
@@ -429,7 +429,7 @@ output:
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/important.png" alt="Important" />
+<img src="./images/icons/important.png" alt="Important" />
</td>
<td class="content">Always use labels for each checkbox and radio button. They associate text with a specific option, while also providing a larger clickable region.</td>
</tr></table>
@@ -451,7 +451,7 @@ output:
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">If you're using password input fields (for any purpose), you might want to prevent their values showing up in application logs by activating <tt>filter_parameter_logging(:password)</tt> in your ApplicationController.</td>
</tr></table>
@@ -557,7 +557,7 @@ form_for(@article)</tt></pre>
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/warning.png" alt="Warning" />
+<img src="./images/icons/warning.png" alt="Warning" />
</td>
<td class="content">When you're using STI (single-table inheritance) with your models, you can't rely on record identification on a subclass if only their parent class is declared a resource. You will have to specify the model name, <tt>:url</tt> and <tt>:method</tt> explicitly.</td>
</tr></table>
diff --git a/railties/doc/guides/html/getting_started_with_rails.html b/railties/doc/guides/html/getting_started_with_rails.html
index 1302e4f70d..e7be98d34a 100644
--- a/railties/doc/guides/html/getting_started_with_rails.html
+++ b/railties/doc/guides/html/getting_started_with_rails.html
@@ -496,7 +496,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">There are some special circumstances in which you might want to use an alternate installation strategy:</td>
</tr></table>
@@ -750,7 +750,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">If you're on Windows, or your Ruby is set up in some non-standard fashion, you may need to explicitly pass Rails <tt>script</tt> commands to Ruby: <tt>ruby script/generate controller home index</tt>.</td>
</tr></table>
@@ -779,7 +779,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">To stop the web server, hit Ctrl+C in the terminal window where it's running. In development mode, Rails does not generally require you to stop the server; changes you make in files will be automatically picked up by the server.</td>
</tr></table>
@@ -817,7 +817,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">For more information about routing, refer to <a href="../routing_outside_in.html">Rails Routing from the Outside In</a>.</td>
</tr></table>
@@ -840,7 +840,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">While scaffolding will get you up and running quickly, the "one size fits all" code that it generates is unlikely to be a perfect fit for your application. In most cases, you'll need to customize the generated code. Many experienced Rails developers avoid scaffolding entirely, preferring to write all or most of their source code from scratch.</td>
</tr></table>
@@ -1015,7 +1015,7 @@ $ rake db<span style="color: #990000">:</span>migrate
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">Because you're working in the development environment by default, both of these commands will apply to the database defined in the <tt>development</tt> section of your <tt>config/database.yml</tt> file.</td>
</tr></table>
@@ -1041,7 +1041,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">In development mode (which is what you're working in by default), Rails reloads your application with every browser request, so there's no need to stop and restart the web server.</td>
</tr></table>
@@ -1101,7 +1101,7 @@ title<span style="color: #990000">:</span> nil<span style="color: #990000">,</sp
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">Unlike the development web server, the console does not automatically load your code afresh for each line. If you make changes, type <tt>reload!</tt> at the console prompt to load them.</td>
</tr></table>
@@ -1126,7 +1126,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">For more information on finding records with Active Record, see <a href="../finders.html">Active Record Finders</a>.</td>
</tr></table>
@@ -1183,7 +1183,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">For more details on the rendering process, see <a href="../layouts_and_rendering.html">Layouts and Rendering in Rails</a>.</td>
</tr></table>
@@ -1264,7 +1264,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">If you need to create an HTML form that displays arbitrary fields, not tied to a model, you should use the <tt>form_tag</tt> method, which provides shortcuts for building forms that are not necessarily tied to a model instance.</td>
</tr></table>
@@ -1400,7 +1400,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">Sharp-eyed readers will have noticed that the <tt>form_for</tt> declaration is identical for the <tt>create</tt> and <tt>edit</tt> views. Rails generates different code for the two forms because it's smart enough to notice that in the one case it's being passed a new record that has never been saved, and in the other case an existing record that has already been saved to the database. In a production Rails application, you would ordinarily eliminate this duplication by moving identical code to a <em>partial template</em>, which you could then include in both parent templates. But the scaffold generator tries not to make too many assumptions, and generates code that’s easy to modify if you want different forms for <tt>create</tt> and <tt>edit</tt>.</td>
</tr></table>
@@ -1536,7 +1536,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">For more information on Active Record associations, see the <a href="../association_basics.html+">Active Record Associations</a> guide.</td>
</tr></table>
@@ -1556,7 +1556,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">For more information on routing, see the <a href="../routing_outside_in">Rails Routing from the Outside In</a> guide.</td>
</tr></table>
diff --git a/railties/doc/guides/html/index.html b/railties/doc/guides/html/index.html
index c3577e98ea..f84442d10c 100644
--- a/railties/doc/guides/html/index.html
+++ b/railties/doc/guides/html/index.html
@@ -202,7 +202,7 @@ ul#navMain {
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/warning.png" alt="Warning" />
+<img src="./images/icons/warning.png" alt="Warning" />
</td>
<td class="content">This page is the result of ongoing <a href="http://hackfest.rubyonrails.org/guide">Rails Guides hackfest</a> and a work in progress.</td>
</tr></table>
@@ -210,7 +210,7 @@ ul#navMain {
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/caution.png" alt="Caution" />
+<img src="./images/icons/caution.png" alt="Caution" />
</td>
<td class="content">Guides marked with this icon are currently being worked on. While they might still be useful to you, they may contain incomplete information and even errors. You can help by reviewing them and posting your comments and corrections at the respective Lighthouse ticket.</td>
</tr></table>
@@ -222,7 +222,7 @@ ul#navMain {
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/caution.png" alt="Caution" />
+<img src="./images/icons/caution.png" alt="Caution" />
</td>
<td class="content"><a href="http://rails.lighthouseapp.com/projects/16213/tickets/2">Lighthouse Ticket</a></td>
</tr></table>
@@ -246,7 +246,7 @@ ul#navMain {
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/caution.png" alt="Caution" />
+<img src="./images/icons/caution.png" alt="Caution" />
</td>
<td class="content"><a href="http://rails.lighthouseapp.com/projects/16213/tickets/16">Lighthouse Ticket</a></td>
</tr></table>
@@ -267,7 +267,7 @@ with partials.</p></div>
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/caution.png" alt="Caution" />
+<img src="./images/icons/caution.png" alt="Caution" />
</td>
<td class="content"><a href="http://rails.lighthouseapp.com/projects/16213/tickets/1">Lighthouse Ticket</a></td>
</tr></table>
@@ -287,7 +287,7 @@ understand how to use routing in your own Rails applications, start here.</p></d
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/caution.png" alt="Caution" />
+<img src="./images/icons/caution.png" alt="Caution" />
</td>
<td class="content"><a href="http://rails.lighthouseapp.com/projects/16213/tickets/17">Lighthouse Ticket</a></td>
</tr></table>
@@ -300,7 +300,7 @@ understand how to use routing in your own Rails applications, start here.</p></d
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/caution.png" alt="Caution" />
+<img src="./images/icons/caution.png" alt="Caution" />
</td>
<td class="content"><a href="http://rails.lighthouseapp.com/projects/16213/tickets/10">Lighthouse Ticket</a></td>
</tr></table>
@@ -314,7 +314,7 @@ understand how to use routing in your own Rails applications, start here.</p></d
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/caution.png" alt="Caution" />
+<img src="./images/icons/caution.png" alt="Caution" />
</td>
<td class="content"><a href="http://rails.lighthouseapp.com/projects/16213/tickets/8">Lighthouse Ticket</a></td>
</tr></table>
@@ -329,7 +329,7 @@ Enjoy.</p></div>
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/caution.png" alt="Caution" />
+<img src="./images/icons/caution.png" alt="Caution" />
</td>
<td class="content"><a href="http://rails.lighthouseapp.com/projects/16213/tickets/7">Lighthouse Ticket</a></td>
</tr></table>
@@ -343,7 +343,7 @@ avoid them with Rails.</p></div>
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/caution.png" alt="Caution" />
+<img src="./images/icons/caution.png" alt="Caution" />
</td>
<td class="content"><a href="http://rails.lighthouseapp.com/projects/16213/tickets/5">Lighthouse Ticket</a></td>
</tr></table>
@@ -358,7 +358,7 @@ of your code.</p></div>
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/caution.png" alt="Caution" />
+<img src="./images/icons/caution.png" alt="Caution" />
</td>
<td class="content"><a href="http://rails.lighthouseapp.com/projects/16213/tickets/4">Lighthouse Ticket</a></td>
</tr></table>
diff --git a/railties/doc/guides/html/layouts_and_rendering.html b/railties/doc/guides/html/layouts_and_rendering.html
index 35d9e670b1..916cdd2053 100644
--- a/railties/doc/guides/html/layouts_and_rendering.html
+++ b/railties/doc/guides/html/layouts_and_rendering.html
@@ -300,7 +300,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">The actual rendering is done by subclasses of <tt>ActionView::TemplateHandlers</tt>. This guide does not dig into that process, but it's important to know that the file extension on your view controls the choice of template handler. In Rails 2, the standard extensions are <tt>.erb</tt> for ERB (HTML with embedded Ruby), <tt>.rjs</tt> for RJS (javascript with embedded ruby) and <tt>.builder</tt> for Builder (XML generator). You'll also find <tt>.rhtml</tt> used for ERB templates and .rxml for Builder templates, but those extensions are now formally deprecated and will be removed from a future version of Rails.</td>
</tr></table>
@@ -310,7 +310,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">If you want to see the exact results of a call to <tt>render</tt> without needing to inspect it in a browser, you can call <tt>render_to_string</tt>. This method takes exactly the same options as <tt>render</tt>, but it returns a string instead of sending a response back to the browser.</td>
</tr></table>
@@ -328,7 +328,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">You should probably be using the <tt>head</tt> method, discussed later in this guide, instead of <tt>render :nothing</tt>. This provides additional flexibility and makes it explicit that you're only generating HTTP headers.</td>
</tr></table>
@@ -354,7 +354,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/warning.png" alt="Warning" />
+<img src="./images/icons/warning.png" alt="Warning" />
</td>
<td class="content">Using <tt>render</tt> with <tt>:action</tt> is a frequent source of confusion for Rails newcomers. The specified action is used to determine which view to render, but Rails does <em>not</em> run any of the code for that action in the controller. Any instance variables that you require in the view must be set up in the current action before calling <tt>render</tt>.</td>
</tr></table>
@@ -381,7 +381,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">By default, if you use the <tt>:file</tt> option, the file is rendered without using the current layout. If you want Rails to put the file into the current layout, you need to add the <tt>:layout &#8658; true</tt> option</td>
</tr></table>
@@ -398,7 +398,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/warning.png" alt="Warning" />
+<img src="./images/icons/warning.png" alt="Warning" />
</td>
<td class="content">There is seldom any good reason to use this option. Mixing ERB into your controllers defeats the MVC orientation of Rails and will make it harder for other developers to follow the logic of your project. Use a separate erb view instead.</td>
</tr></table>
@@ -425,7 +425,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/warning.png" alt="Warning" />
+<img src="./images/icons/warning.png" alt="Warning" />
</td>
<td class="content">Placing javascript updates in your controller may seem to streamline small updates, but it defeats the MVC orientation of Rails and will make it harder for other developers to follow the logic of your project. I recommend using a separate rjs template instead, no matter how small the update.</td>
</tr></table>
@@ -442,7 +442,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">Rendering pure text is most useful when you're responding to AJAX or web service requests that are expecting something other than proper HTML.</td>
</tr></table>
@@ -450,7 +450,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">By default, if you use the <tt>:text</tt> option, the file is rendered without using the current layout. If you want Rails to put the text into the current layout, you need to add the <tt>:layout &#8658; true</tt> option</td>
</tr></table>
@@ -467,7 +467,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">You don't need to call <tt>to_json</tt> on the object that you want to render. If you use the <tt>:json</tt> option, <tt>render</tt> will automatically call <tt>to_json</tt> for you.</td>
</tr></table>
@@ -484,7 +484,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">You don't need to call <tt>to_xml</tt> on the object that you want to render. If you use the <tt>:xml</tt> option, <tt>render</tt> will automatically call <tt>to_xml</tt> for you.</td>
</tr></table>
@@ -714,7 +714,7 @@ image_tag
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/warning.png" alt="Warning" />
+<img src="./images/icons/warning.png" alt="Warning" />
</td>
<td class="content">The asset tags do <em>not</em> verify the existence of the assets at the specified locations; they simply assume that you know what you're doing and generate the link.</td>
</tr></table>
@@ -1036,7 +1036,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">For content that is shared among all pages in your application, you can use partials directly from layouts.</td>
</tr></table>
diff --git a/railties/doc/guides/html/migrations.html b/railties/doc/guides/html/migrations.html
index 0fd30ee2eb..fd466d3a02 100644
--- a/railties/doc/guides/html/migrations.html
+++ b/railties/doc/guides/html/migrations.html
@@ -354,7 +354,7 @@ to have already opted in, so we use the User model to set the flag to <tt>true</
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">Some <a href="#models">caveats</a> apply to using models in your migrations.</td>
</tr></table>
@@ -657,7 +657,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">The <tt>references</tt> helper does not actually create foreign key constraints for you. You will need to use <tt>execute</tt> for that or a plugin that adds <a href="#foreign_key">foreign key support</a>.</td>
</tr></table>
@@ -728,7 +728,7 @@ version is the numerical prefix on the migration's filename. For example to migr
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">This is not the same as running all the migrations - see the section on <a href="#schema">schema.rb</a>.</td>
</tr></table>
diff --git a/railties/doc/guides/html/routing_outside_in.html b/railties/doc/guides/html/routing_outside_in.html
index efa14d5ad8..ca8958eef9 100644
--- a/railties/doc/guides/html/routing_outside_in.html
+++ b/railties/doc/guides/html/routing_outside_in.html
@@ -372,7 +372,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">Patient needs to be declared as a resource for this style of translation via a named route to be available.</td>
</tr></table>
@@ -647,7 +647,7 @@ cellspacing="0" cellpadding="4">
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">If you consistently use RESTful routes in your application, you should disable the default routes in <tt>routes.rb</tt> so that Rails will enforce the mapping between HTTP verbs and routes.</td>
</tr></table>
@@ -679,7 +679,7 @@ cellspacing="0" cellpadding="4">
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">Because routing makes use of the HTTP verb as well as the path in the request to dispatch requests, the seven routes generated by a RESTful routing entry only give rise to four pairs of helpers.</td>
</tr></table>
@@ -859,7 +859,7 @@ cellspacing="0" cellpadding="4">
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">Even though the name of the resource is singular in <tt>routes.rb</tt>, the matching controller is still plural.</td>
</tr></table>
@@ -1091,7 +1091,7 @@ cellspacing="0" cellpadding="4">
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">The helpers will be generated with the name of the resource, not the name of the controller. So in this case, you'd still get <tt>photos_path</tt>, <tt>new_photo_path</tt>, and so on.</td>
</tr></table>
@@ -1109,7 +1109,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">If you want to guarantee that a link goes to a top-level controller, use a preceding slash to anchor the controller name: <tt>&lt;%= link_to "show", {:controller &#8658; "/photos", :action &#8658; "show"} %&gt;</tt></td>
</tr></table>
@@ -1145,7 +1145,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">Depending on the other code in your application, you may prefer to add additional rules to the <tt>Inflector</tt> class instead.</td>
</tr></table>
@@ -1326,7 +1326,7 @@ cellspacing="0" cellpadding="4">
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">The helpers will be generated with the name of the resource, not the path name. So in this case, you'd still get <tt>photos_path</tt>, <tt>new_photo_path</tt>, and so on.</td>
</tr></table>
@@ -1349,7 +1349,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">The actual action names aren't changed by this option; the two URLs show would still route to the new and edit actions.</td>
</tr></table>
@@ -1357,7 +1357,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">If you find yourself wanting to change this option uniformly for all of your routes, you can set a default in your environment:</td>
</tr></table>
@@ -1387,7 +1387,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">In most cases, it's simpler to recognize URLs of this sort by creating nested resources, as discussed in the next section.</td>
</tr></table>
@@ -1395,7 +1395,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">You can also use <tt>:path_prefix</tt> with non-RESTful routes.</td>
</tr></table>
@@ -1414,7 +1414,7 @@ map<span style="color: #990000">.</span>resources <span style="color: #990000">:
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">You can also use <tt>:name_prefix</tt> with non-RESTful routes.</td>
</tr></table>
@@ -1808,7 +1808,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">If you want to redefine the verbs accepted by one of the standard actions, you can do so by explicitly mapping that action. For example:</td>
</tr></table>
@@ -2001,7 +2001,7 @@ map<span style="color: #990000">.</span>connect <span style="color: #FF0000">':c
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">The default routes will make every action of every controller in your application accessible to GET requests. If you've designed your application to make consistent use of RESTful and named routes, you should comment out the default routes to prevent access to your controllers through the wrong verbs. If you've had the default routes enabled during development, though, you need to be sure that you haven't unwittingly depended on them somewhere in your application - otherwise you may find mysterious failures when you disable them.</td>
</tr></table>
@@ -2042,7 +2042,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">If the empty route does not seem to be working in your application, make sure that you have deleted the file <tt>public/index.html</tt> from your Rails tree.</td>
</tr></table>
@@ -2086,7 +2086,7 @@ formatted_users GET /users.:format {:controller=&gt;"users", :action=&gt;"inde
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">You'll find that the output from <tt>rake routes</tt> is much more readable if you widen your terminal window until the output lines don't wrap.</td>
</tr></table>
diff --git a/railties/doc/guides/html/testing_rails_applications.html b/railties/doc/guides/html/testing_rails_applications.html
index b2e0b1bbc1..73634ef328 100644
--- a/railties/doc/guides/html/testing_rails_applications.html
+++ b/railties/doc/guides/html/testing_rails_applications.html
@@ -762,7 +762,7 @@ NameError: undefined local variable or method `some_undefined_variable' for #&lt
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">The execution of each test method stops as soon as any error or a assertion failure is encountered, and the test suite continues with the next method. All test methods are executed in alphabetical order.</td>
</tr></table>
@@ -772,7 +772,7 @@ NameError: undefined local variable or method `some_undefined_variable' for #&lt
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">Many Rails developers practice <em>test-driven development</em> (TDD), in which the tests are written <em>before</em> the code that they are testing. This is an excellent way to build up a test suite that exercises every part of your application. TDD is beyond the scope of this guide, but one place to start is with <a href="http://andrzejonsoftware.blogspot.com/2007/05/15-tdd-steps-to-create-rails.html">15 TDD steps to create a Rails application</a>.</td>
</tr></table>
@@ -956,7 +956,7 @@ cellspacing="0" cellpadding="4">
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">Creating your own assertions is an advanced topic that we won't cover in this tutorial.</td>
</tr></table>
@@ -1266,7 +1266,7 @@ http://www.gnu.org/software/src-highlite -->
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/note.png" alt="Note" />
+<img src="./images/icons/note.png" alt="Note" />
</td>
<td class="content">You may find references to <tt>assert_tag</tt> in other documentation, but this is now deprecated in favor of <tt>assert_select</tt>.</td>
</tr></table>
@@ -1696,7 +1696,7 @@ Tasks Description</p></div>
<div class="admonitionblock">
<table><tr>
<td class="icon">
-<img src="/Users/lifo/Docs/docrails/railties/doc/guides/source/icons/tip.png" alt="Tip" />
+<img src="./images/icons/tip.png" alt="Tip" />
</td>
<td class="content">You can see all these rake task and their descriptions by running <tt>rake &#8212;tasks &#8212;describe</tt></td>
</tr></table>
diff --git a/railties/doc/guides/source/finders.txt b/railties/doc/guides/source/finders.txt
index e81fa23e3a..a86191aaf4 100644
--- a/railties/doc/guides/source/finders.txt
+++ b/railties/doc/guides/source/finders.txt
@@ -183,7 +183,17 @@ SELECT * FROM clients LIMIT 5, 5
== Group
-TODO
+The group option for find is useful, for example, if you want to find a collection of the dates orders were created on. We could use the option in this context:
+
+[source, ruby]
+Order.find(:all, :group => "date(created_at)", :order => "created_at")
+
+And this will give us a single Order object for each date that we have orders in our database.
+
+The SQL that would be executed would be something like this:
+
+[source, sql]
+SELECT * FROM `orders` GROUP BY date(created_at)
== Read Only
@@ -203,7 +213,7 @@ client.save
If you're wanting to stop race conditions for a specific record, say for example you're incrementing a single field for a record you can use the lock option to ensure that the record is updated correctly. It's recommended this be used inside a transaction.
-[source, Ruby]
+[source, ruby]
Topic.transaction do
t = Topic.find(params[:id], :lock => true)
t.increment!(:views)
@@ -233,7 +243,7 @@ This query is more efficent, but there's a gotcha. If you have a client who does
When using eager loading you can specify conditions for the columns of the tables inside the eager loading to get back a smaller subset. If, for example, you want to find a client and all their orders within the last two weeks you could use eager loading with conditions for this:
-[source, Ruby]
+[source, ruby]
Client.find(:first, :include => "orders", :conditions => ["orders.created_at >= ? AND orders.created_at <= ?", Time.now - 2.weeks, Time.now])
@@ -368,22 +378,76 @@ Client.exists?(:conditions => "first_name = 'Ryan'")
== Calculations
-=== Count
-
-If you want to see how many records are in your models table you could call `Client.count` and that will return the number. If you want to be more specific and find all the clients with their age present in the database you can use `Client.count(:age)`.
+This section uses count as an example method in this preamble, but the options described apply to all sub-sections.
`count` takes conditions much in the same way `exists?` does:
[source, ruby]
Client.count(:conditions => "first_name = 'Ryan'")
+Which will execute:
+
[source, sql]
SELECT count(*) AS count_all FROM `clients` WHERE (first_name = 1)
-== With Scope
+You can also use `include` or `joins` for this to do something a little more complex:
+
+[source, ruby]
+Client.count(:conditions => "clients.first_name = 'Ryan' AND orders.status = 'received'", :include => "orders")
+
+Which will execute:
+
+[source, sql]
+SELECT count(DISTINCT `clients`.id) AS count_all FROM `clients` LEFT OUTER JOIN `orders` ON orders.client_id = client.id WHERE (clients.first_name = 'name' AND orders.status = 'received')
+
+We specify `clients.first_name` just in case one of our join tables has a field also called `first_name` and we do `orders.status` because that's the name of our join table.
+
+
+=== Count
+
+If you want to see how many records are in your model's table you could call `Client.count` and that will return the number. If you want to be more specific and find all the clients with their age present in the database you can use `Client.count(:age)`.
+
+For options, please see the parent section, Calculations.
+
+=== Average
+
+If you want to see the average of a certain number in one of your tables you can call the `average` method on the class that relates to the table. This method call will look something like this:
+
+[source, ruby]
+Client.average("orders_count")
+
+This will return a number (possibly a floating point number such as 3.14159265) representing the average of the fields.
+
+For options, please see the parent section, <<_calculations, Calculations>>
+
+=== Minimum
+
+If you want to find the minimum value of a field in your table you can call the `minimum` method on the class that relates to the table. This method call will look something like this:
+
+[source, ruby]
+Client.minimum("age")
+
+For options, please see the parent section, <<_calculations, Calculations>>
+
+=== Maximum
+
+If you want to find the maximum value of a field in your table you can call the `maximum` method on the class that relates to the table. This method call will look something like this:
+
+[source, ruby]
+Client.maximum("age")
+
+For options, please see the parent section, <<_calculations, Calculations>>
+
+
+=== Sum
+
+If you want to find the sum of a field for all records in your table you can call the `sum` method on the class that relates to the table. This method call will look something like this:
+
+[source, ruby]
+Client.sum("orders_count")
+
+For options, please see the parent section, <<_calculations, Calculations>>
-TODO
-
== Credits
Thanks to Ryan Bates for his awesome screencast on named scope #108. The information within the named scope section is intentionally similar to it, and without the cast may have not been possible.
@@ -419,3 +483,6 @@ Thanks to Mike Gunderloy for his tips on creating this guide.
=== Tuesday, 21 October 2008
1. Extended named scope guide by adding :include and :joins and find sub-sections.
+
+=== Wednesday, 22 October 2008
+1. Completed calculations section.
diff --git a/railties/doc/guides/source/icons/README b/railties/doc/guides/source/images/icons/README
index f12b2a730c..f12b2a730c 100644
--- a/railties/doc/guides/source/icons/README
+++ b/railties/doc/guides/source/images/icons/README
diff --git a/railties/doc/guides/source/icons/callouts/1.png b/railties/doc/guides/source/images/icons/callouts/1.png
index 7d473430b7..7d473430b7 100644
--- a/railties/doc/guides/source/icons/callouts/1.png
+++ b/railties/doc/guides/source/images/icons/callouts/1.png
Binary files differ
diff --git a/railties/doc/guides/source/icons/callouts/10.png b/railties/doc/guides/source/images/icons/callouts/10.png
index 997bbc8246..997bbc8246 100644
--- a/railties/doc/guides/source/icons/callouts/10.png
+++ b/railties/doc/guides/source/images/icons/callouts/10.png
Binary files differ
diff --git a/railties/doc/guides/source/icons/callouts/11.png b/railties/doc/guides/source/images/icons/callouts/11.png
index ce47dac3f5..ce47dac3f5 100644
--- a/railties/doc/guides/source/icons/callouts/11.png
+++ b/railties/doc/guides/source/images/icons/callouts/11.png
Binary files differ
diff --git a/railties/doc/guides/source/icons/callouts/12.png b/railties/doc/guides/source/images/icons/callouts/12.png
index 31daf4e2f2..31daf4e2f2 100644
--- a/railties/doc/guides/source/icons/callouts/12.png
+++ b/railties/doc/guides/source/images/icons/callouts/12.png
Binary files differ
diff --git a/railties/doc/guides/source/icons/callouts/13.png b/railties/doc/guides/source/images/icons/callouts/13.png
index 14021a89c2..14021a89c2 100644
--- a/railties/doc/guides/source/icons/callouts/13.png
+++ b/railties/doc/guides/source/images/icons/callouts/13.png
Binary files differ
diff --git a/railties/doc/guides/source/icons/callouts/14.png b/railties/doc/guides/source/images/icons/callouts/14.png
index 64014b75fe..64014b75fe 100644
--- a/railties/doc/guides/source/icons/callouts/14.png
+++ b/railties/doc/guides/source/images/icons/callouts/14.png
Binary files differ
diff --git a/railties/doc/guides/source/icons/callouts/15.png b/railties/doc/guides/source/images/icons/callouts/15.png
index 0d65765fcf..0d65765fcf 100644
--- a/railties/doc/guides/source/icons/callouts/15.png
+++ b/railties/doc/guides/source/images/icons/callouts/15.png
Binary files differ
diff --git a/railties/doc/guides/source/icons/callouts/2.png b/railties/doc/guides/source/images/icons/callouts/2.png
index 5d09341b2f..5d09341b2f 100644
--- a/railties/doc/guides/source/icons/callouts/2.png
+++ b/railties/doc/guides/source/images/icons/callouts/2.png
Binary files differ
diff --git a/railties/doc/guides/source/icons/callouts/3.png b/railties/doc/guides/source/images/icons/callouts/3.png
index ef7b700471..ef7b700471 100644
--- a/railties/doc/guides/source/icons/callouts/3.png
+++ b/railties/doc/guides/source/images/icons/callouts/3.png
Binary files differ
diff --git a/railties/doc/guides/source/icons/callouts/4.png b/railties/doc/guides/source/images/icons/callouts/4.png
index adb8364eb5..adb8364eb5 100644
--- a/railties/doc/guides/source/icons/callouts/4.png
+++ b/railties/doc/guides/source/images/icons/callouts/4.png
Binary files differ
diff --git a/railties/doc/guides/source/icons/callouts/5.png b/railties/doc/guides/source/images/icons/callouts/5.png
index 4d7eb46002..4d7eb46002 100644
--- a/railties/doc/guides/source/icons/callouts/5.png
+++ b/railties/doc/guides/source/images/icons/callouts/5.png
Binary files differ
diff --git a/railties/doc/guides/source/icons/callouts/6.png b/railties/doc/guides/source/images/icons/callouts/6.png
index 0ba694af6c..0ba694af6c 100644
--- a/railties/doc/guides/source/icons/callouts/6.png
+++ b/railties/doc/guides/source/images/icons/callouts/6.png
Binary files differ
diff --git a/railties/doc/guides/source/icons/callouts/7.png b/railties/doc/guides/source/images/icons/callouts/7.png
index 472e96f8ac..472e96f8ac 100644
--- a/railties/doc/guides/source/icons/callouts/7.png
+++ b/railties/doc/guides/source/images/icons/callouts/7.png
Binary files differ
diff --git a/railties/doc/guides/source/icons/callouts/8.png b/railties/doc/guides/source/images/icons/callouts/8.png
index 5e60973c21..5e60973c21 100644
--- a/railties/doc/guides/source/icons/callouts/8.png
+++ b/railties/doc/guides/source/images/icons/callouts/8.png
Binary files differ
diff --git a/railties/doc/guides/source/icons/callouts/9.png b/railties/doc/guides/source/images/icons/callouts/9.png
index a0676d26cc..a0676d26cc 100644
--- a/railties/doc/guides/source/icons/callouts/9.png
+++ b/railties/doc/guides/source/images/icons/callouts/9.png
Binary files differ
diff --git a/railties/doc/guides/source/icons/caution.png b/railties/doc/guides/source/images/icons/caution.png
index cb9d5ea0df..cb9d5ea0df 100644
--- a/railties/doc/guides/source/icons/caution.png
+++ b/railties/doc/guides/source/images/icons/caution.png
Binary files differ
diff --git a/railties/doc/guides/source/icons/example.png b/railties/doc/guides/source/images/icons/example.png
index bba1c0010d..bba1c0010d 100644
--- a/railties/doc/guides/source/icons/example.png
+++ b/railties/doc/guides/source/images/icons/example.png
Binary files differ
diff --git a/railties/doc/guides/source/icons/home.png b/railties/doc/guides/source/images/icons/home.png
index 37a5231bac..37a5231bac 100644
--- a/railties/doc/guides/source/icons/home.png
+++ b/railties/doc/guides/source/images/icons/home.png
Binary files differ
diff --git a/railties/doc/guides/source/icons/important.png b/railties/doc/guides/source/images/icons/important.png
index 1096c23295..1096c23295 100644
--- a/railties/doc/guides/source/icons/important.png
+++ b/railties/doc/guides/source/images/icons/important.png
Binary files differ
diff --git a/railties/doc/guides/source/icons/next.png b/railties/doc/guides/source/images/icons/next.png
index 64e126bdda..64e126bdda 100644
--- a/railties/doc/guides/source/icons/next.png
+++ b/railties/doc/guides/source/images/icons/next.png
Binary files differ
diff --git a/railties/doc/guides/source/icons/note.png b/railties/doc/guides/source/images/icons/note.png
index 841820f7c4..841820f7c4 100644
--- a/railties/doc/guides/source/icons/note.png
+++ b/railties/doc/guides/source/images/icons/note.png
Binary files differ
diff --git a/railties/doc/guides/source/icons/prev.png b/railties/doc/guides/source/images/icons/prev.png
index 3e8f12fe24..3e8f12fe24 100644
--- a/railties/doc/guides/source/icons/prev.png
+++ b/railties/doc/guides/source/images/icons/prev.png
Binary files differ
diff --git a/railties/doc/guides/source/icons/tip.png b/railties/doc/guides/source/images/icons/tip.png
index a3a029d898..a3a029d898 100644
--- a/railties/doc/guides/source/icons/tip.png
+++ b/railties/doc/guides/source/images/icons/tip.png
Binary files differ
diff --git a/railties/doc/guides/source/icons/up.png b/railties/doc/guides/source/images/icons/up.png
index 2db1ce62fa..2db1ce62fa 100644
--- a/railties/doc/guides/source/icons/up.png
+++ b/railties/doc/guides/source/images/icons/up.png
Binary files differ
diff --git a/railties/doc/guides/source/icons/warning.png b/railties/doc/guides/source/images/icons/warning.png
index 0b0c419df2..0b0c419df2 100644
--- a/railties/doc/guides/source/icons/warning.png
+++ b/railties/doc/guides/source/images/icons/warning.png
Binary files differ
diff --git a/railties/lib/tasks/documentation.rake b/railties/lib/tasks/documentation.rake
index 77b6532fbf..6caf69ccd3 100644
--- a/railties/lib/tasks/documentation.rake
+++ b/railties/lib/tasks/documentation.rake
@@ -61,7 +61,7 @@ namespace :doc do
FileUtils.cp_r File.join(source, 'html/.'), File.join(destination)
# Copy images and css files to html directory. These dirs are in .gitigore and shouldn't be source controlled.
- FileUtils.cp_r File.join(source, 'source/images'), File.join(destination, 'images')
+ FileUtils.cp_r File.join(source, 'source/images'), File.join(destination)
FileUtils.cp_r File.join(source, 'source/stylesheets'), File.join(destination, 'stylesheets')
end