aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/lib/action_controller/caching.rb2
-rw-r--r--actionpack/lib/action_controller/caching/actions.rb2
-rw-r--r--actionpack/lib/action_view/helpers/date_helper.rb6
-rw-r--r--actionpack/lib/action_view/helpers/form_tag_helper.rb2
-rw-r--r--railties/guides/rails_guides/generator.rb2
-rw-r--r--railties/guides/rails_guides/levenshtein.rb48
-rw-r--r--railties/guides/source/2_3_release_notes.textile2
-rw-r--r--railties/guides/source/action_view_overview.textile69
-rw-r--r--railties/guides/source/getting_started.textile2
-rw-r--r--railties/guides/source/rails_application_templates.textile18
10 files changed, 121 insertions, 32 deletions
diff --git a/actionpack/lib/action_controller/caching.rb b/actionpack/lib/action_controller/caching.rb
index 80d13e25f1..ffd8081edc 100644
--- a/actionpack/lib/action_controller/caching.rb
+++ b/actionpack/lib/action_controller/caching.rb
@@ -13,7 +13,7 @@ module ActionController #:nodoc:
#
# == Caching stores
#
- # All the caching stores from ActiveSupport::Cache is available to be used as backends for Action Controller caching. This setting only
+ # All the caching stores from ActiveSupport::Cache are available to be used as backends for Action Controller caching. This setting only
# affects action and fragment caching as page caching is always written to disk.
#
# Configuration examples (MemoryStore is the default):
diff --git a/actionpack/lib/action_controller/caching/actions.rb b/actionpack/lib/action_controller/caching/actions.rb
index 87b5029e57..b99feddf77 100644
--- a/actionpack/lib/action_controller/caching/actions.rb
+++ b/actionpack/lib/action_controller/caching/actions.rb
@@ -134,7 +134,7 @@ module ActionController #:nodoc:
end
end
- # When true, infer_extension will look up the cache path extension from the request's path & format.
+ # If +infer_extension+ is true, the cache path extension is looked up from the request's path & format.
# This is desirable when reading and writing the cache, but not when expiring the cache -
# expire_action should expire the same files regardless of the request format.
def initialize(controller, options = {}, infer_extension = true)
diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb
index c74909a360..72fe9a3232 100644
--- a/actionpack/lib/action_view/helpers/date_helper.rb
+++ b/actionpack/lib/action_view/helpers/date_helper.rb
@@ -106,8 +106,8 @@ module ActionView
alias_method :distance_of_time_in_words_to_now, :time_ago_in_words
# Returns a set of select tags (one for year, month, and day) pre-selected for accessing a specified date-based
- # attribute (identified by +method+) on an object assigned to the template (identified by +object+). You can
- # the output in the +options+ hash.
+ # attribute (identified by +method+) on an object assigned to the template (identified by +object+).
+ #
#
# ==== Options
# * <tt>:use_month_numbers</tt> - Set to true if you want to use month numbers rather than month names (e.g.
@@ -232,7 +232,7 @@ module ActionView
# Returns a set of select tags (one for year, month, day, hour, and minute) pre-selected for accessing a
# specified datetime-based attribute (identified by +method+) on an object assigned to the template (identified
- # by +object+). Examples:
+ # by +object+).
#
# If anything is passed in the html_options hash it will be applied to every select tag in the set.
#
diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb
index 6d39a53adc..daf38fe3da 100644
--- a/actionpack/lib/action_view/helpers/form_tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb
@@ -406,7 +406,7 @@ module ActionView
# <tt>legend</tt> will become the fieldset's title (optional as per W3C).
# <tt>options</tt> accept the same values as tag.
#
- # === Examples
+ # ==== Examples
# <% field_set_tag do %>
# <p><%= text_field_tag 'name' %></p>
# <% end %>
diff --git a/railties/guides/rails_guides/generator.rb b/railties/guides/rails_guides/generator.rb
index f93282db2e..2a4714b13a 100644
--- a/railties/guides/rails_guides/generator.rb
+++ b/railties/guides/rails_guides/generator.rb
@@ -48,7 +48,7 @@ module RailsGuides
if guide =~ /\.erb\.textile/
# Generate the erb pages with textile formatting - e.g. index/authors
- result = view.render(:layout => 'layout', :file => name)
+ result = view.render(:layout => 'layout', :file => guide)
f.write textile(result)
else
body = File.read(File.join(view_path, guide))
diff --git a/railties/guides/rails_guides/levenshtein.rb b/railties/guides/rails_guides/levenshtein.rb
index 4010b61e26..f99c6e6ba8 100644
--- a/railties/guides/rails_guides/levenshtein.rb
+++ b/railties/guides/rails_guides/levenshtein.rb
@@ -1,29 +1,31 @@
-module Levenshtein
- # Based on the pseudocode in http://en.wikipedia.org/wiki/Levenshtein_distance.
- def self.distance(s1, s2)
- s = s1.unpack('U*')
- t = s2.unpack('U*')
- m = s.length
- n = t.length
+module RailsGuides
+ module Levenshtein
+ # Based on the pseudocode in http://en.wikipedia.org/wiki/Levenshtein_distance.
+ def self.distance(s1, s2)
+ s = s1.unpack('U*')
+ t = s2.unpack('U*')
+ m = s.length
+ n = t.length
- # matrix initialization
- d = []
- 0.upto(m) { |i| d << [i] }
- 0.upto(n) { |j| d[0][j] = j }
+ # matrix initialization
+ d = []
+ 0.upto(m) { |i| d << [i] }
+ 0.upto(n) { |j| d[0][j] = j }
- # distance computation
- 1.upto(m) do |i|
- 1.upto(n) do |j|
- cost = s[i] == t[j] ? 0 : 1
- d[i][j] = [
- d[i-1][j] + 1, # deletion
- d[i][j-1] + 1, # insertion
- d[i-1][j-1] + cost, # substitution
- ].min
+ # distance computation
+ 1.upto(m) do |i|
+ 1.upto(n) do |j|
+ cost = s[i] == t[j] ? 0 : 1
+ d[i][j] = [
+ d[i-1][j] + 1, # deletion
+ d[i][j-1] + 1, # insertion
+ d[i-1][j-1] + cost, # substitution
+ ].min
+ end
end
- end
- # all done
- return d[m][n]
+ # all done
+ return d[m][n]
+ end
end
end
diff --git a/railties/guides/source/2_3_release_notes.textile b/railties/guides/source/2_3_release_notes.textile
index 6a97fd2cd1..bb2998fbdf 100644
--- a/railties/guides/source/2_3_release_notes.textile
+++ b/railties/guides/source/2_3_release_notes.textile
@@ -582,7 +582,7 @@ h4. Other Railties Changes
* The default +environment.rb+ file has been decluttered.
* The dbconsole script now lets you use an all-numeric password without crashing.
* +Rails.root+ now returns a +Pathname+ object, which means you can use it directly with the +join+ method to "clean up existing code":http://afreshcup.com/2008/12/05/a-little-rails_root-tidiness/ that uses +File.join+.
-* Various files in /public that deal with CGI and FCGI dispatching are no longer generated in every Rails application by default (you can still get them if you need them by adding +--with-dispatches+ when you run the +rails+ command, or add them later with +rake rails:generate_dispatchers+).
+* Various files in /public that deal with CGI and FCGI dispatching are no longer generated in every Rails application by default (you can still get them if you need them by adding +--with-dispatchers+ when you run the +rails+ command, or add them later with +rake rails:update:generate_dispatchers+).
* Rails Guides have been converted from AsciiDoc to Textile markup.
* Scaffolded views and controllers have been cleaned up a bit.
* +script/server+ now accepts a <tt>--path</tt> argument to mount a Rails application from a specific path.
diff --git a/railties/guides/source/action_view_overview.textile b/railties/guides/source/action_view_overview.textile
new file mode 100644
index 0000000000..ebc267ab71
--- /dev/null
+++ b/railties/guides/source/action_view_overview.textile
@@ -0,0 +1,69 @@
+h2. Action View Overview
+
+In this guide you will learn:
+
+* What Action View is, and how to use it
+
+endprologue.
+
+h3. What is Action View?
+
+TODO...
+
+h3. Using Action View with Rails
+
+TODO...
+
+h3. Using Action View outside of Rails
+
+TODO...
+
+h3. Templates, Partials and Layouts
+
+TODO...
+
+h3. Using Templates, Partials and Layouts in "The Rails Way"
+
+TODO...
+
+h3. Partial Layouts
+
+TODO...
+
+h3. View Paths
+
+TODO...
+
+h3. Overview of all the helpers provided by AV
+
+TODO...
+
+h3. Localized Views
+
+Action View has the ability render different templates depending on the current locale.
+
+For example, suppose you have a Posts controller with a show action. By default, calling this action will render +app/views/posts/show.html.erb+. But if you set +I18n.locale = :de+, then +app/views/posts/show.de.html.erb+ will be rendered instead. If the localized template isn't present, the undecorated version will be used. This means you're not required to provide localized views for all cases, but they will be preferred and used if available.
+
+TODO add full code example...
+
+You can use the same technique to localize the rescue files in your public directory. For example, setting +I18n.locale = :de+ and creating +public/500.de.html+ and +public/404.de.html+ would allow you to have localized rescue pages.
+
+Since Rails doesn't restrict the symbols that you use to set I18n.locale, you can leverage this system to display different content depending on anything you like. For example, suppose you have some "expert" users that should see different pages from "normal" users. You could add the following to +app/controllers/application.rb+:
+
+<ruby>
+before_filter :set_expert_locale
+
+def set_expert_locale
+ I18n.locale = :expert if current_user.expert?
+end
+</ruby>
+
+Then you could create special views like +app/views/posts/show.expert.html.erb+, which would only be displayed to expert users.
+
+You can read more about the Rails Internationalization (I18n) API "here":i18n.html.
+
+h3. Changelog
+
+"Lighthouse Ticket":http://rails.lighthouseapp.com/projects/16213-rails-guides/tickets/71
+
+* April 5, 2009: Starting work by Trevor Turk, leveraging Mike Gunderloy's docs
diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile
index a216201490..7c029762a3 100644
--- a/railties/guides/source/getting_started.textile
+++ b/railties/guides/source/getting_started.textile
@@ -1269,7 +1269,7 @@ You'll also need to modify +views/posts/_form.html.erb+ to include the tags:
With these changes in place, you'll find that you can edit a post and its tags directly on the same view.
-NOTE. You may want to use javascript to dynamically add additional tags on a single form. For an example of this and other advanced techniques, see the "nested model sample application":http://github.com/alloy/complex-form-examples/tree/nested_attributes.
+NOTE. You may want to use JavaScript to dynamically add additional tags on a single form. For an example of this and other advanced techniques, see the "complex form examples application":http://github.com/alloy/complex-form-examples/tree/master.
h3. What's Next?
diff --git a/railties/guides/source/rails_application_templates.textile b/railties/guides/source/rails_application_templates.textile
new file mode 100644
index 0000000000..49cd5bf5f5
--- /dev/null
+++ b/railties/guides/source/rails_application_templates.textile
@@ -0,0 +1,18 @@
+h2. Rails Application Templates
+
+This guide covers the Rails application templates, By referring to this guide, you will be able to:
+
+* Use existing templates to generate a customized Rails application
+* Write your own reusable Rails application templates
+
+endprologue.
+
+h3. Introduction
+
+Application templates are simple ruby files containing DSL for adding plugins/gems/initializers etc. to your freshly created Rails project or an existing Rails project.
+
+h3. Changelog
+
+"Lighthouse ticket":http://rails.lighthouseapp.com/projects/16213-rails-guides/tickets/78
+
+* April 17, 2009: Initial version by "Pratik":credits.html#lifo