Permalink
Browse files

Merge commit 'docrails/master'

  • Loading branch information...
fxn committed Apr 4, 2010
2 parents b546945 + 00884a5 commit 723e91e9fd594856aa7bcd38b04d04acd03039be
Showing with 121 additions and 112 deletions.
  1. +1 −1 actionpack/lib/action_controller/record_identifier.rb
  2. +1 −1 actionpack/lib/action_dispatch/routing/url_for.rb
  3. +2 −2 actionpack/lib/action_view/helpers/atom_feed_helper.rb
  4. +13 −13 actionpack/lib/action_view/helpers/form_helper.rb
  5. +1 −1 activerecord/lib/active_record/base.rb
  6. BIN railties/guides/{ → assets}/images/belongs_to.png
  7. BIN railties/guides/{ → assets}/images/book_icon.gif
  8. BIN railties/guides/{ → assets}/images/bullet.gif
  9. BIN railties/guides/{ → assets}/images/challenge.png
  10. BIN railties/guides/{ → assets}/images/chapters_icon.gif
  11. BIN railties/guides/{ → assets}/images/check_bullet.gif
  12. BIN railties/guides/{ → assets}/images/credits_pic_blank.gif
  13. BIN railties/guides/{ → assets}/images/csrf.png
  14. BIN railties/guides/{ → assets}/images/customized_error_messages.png
  15. BIN railties/guides/{ → assets}/images/edge_badge.png
  16. BIN railties/guides/{ → assets}/images/error_messages.png
  17. BIN railties/guides/{ → assets}/images/feature_tile.gif
  18. BIN railties/guides/{ → assets}/images/footer_tile.gif
  19. BIN railties/guides/{ → assets}/images/fxn.png
  20. BIN railties/guides/{ → assets}/images/grey_bullet.gif
  21. BIN railties/guides/{ → assets}/images/habtm.png
  22. BIN railties/guides/{ → assets}/images/has_many.png
  23. BIN railties/guides/{ → assets}/images/has_many_through.png
  24. BIN railties/guides/{ → assets}/images/has_one.png
  25. BIN railties/guides/{ → assets}/images/has_one_through.png
  26. BIN railties/guides/{ → assets}/images/header_backdrop.png
  27. BIN railties/guides/{ → assets}/images/header_tile.gif
  28. BIN railties/guides/{ → assets}/images/i18n/demo_localized_pirate.png
  29. BIN railties/guides/{ → assets}/images/i18n/demo_translated_en.png
  30. BIN railties/guides/{ → assets}/images/i18n/demo_translated_pirate.png
  31. BIN railties/guides/{ → assets}/images/i18n/demo_translation_missing.png
  32. BIN railties/guides/{ → assets}/images/i18n/demo_untranslated.png
  33. 0 railties/guides/{ → assets}/images/icons/README
  34. BIN railties/guides/{ → assets}/images/icons/callouts/1.png
  35. BIN railties/guides/{ → assets}/images/icons/callouts/10.png
  36. BIN railties/guides/{ → assets}/images/icons/callouts/11.png
  37. BIN railties/guides/{ → assets}/images/icons/callouts/12.png
  38. BIN railties/guides/{ → assets}/images/icons/callouts/13.png
  39. BIN railties/guides/{ → assets}/images/icons/callouts/14.png
  40. BIN railties/guides/{ → assets}/images/icons/callouts/15.png
  41. BIN railties/guides/{ → assets}/images/icons/callouts/2.png
  42. BIN railties/guides/{ → assets}/images/icons/callouts/3.png
  43. BIN railties/guides/{ → assets}/images/icons/callouts/4.png
  44. BIN railties/guides/{ → assets}/images/icons/callouts/5.png
  45. BIN railties/guides/{ → assets}/images/icons/callouts/6.png
  46. BIN railties/guides/{ → assets}/images/icons/callouts/7.png
  47. BIN railties/guides/{ → assets}/images/icons/callouts/8.png
  48. BIN railties/guides/{ → assets}/images/icons/callouts/9.png
  49. BIN railties/guides/{ → assets}/images/icons/caution.png
  50. BIN railties/guides/{ → assets}/images/icons/example.png
  51. BIN railties/guides/{ → assets}/images/icons/home.png
  52. BIN railties/guides/{ → assets}/images/icons/important.png
  53. BIN railties/guides/{ → assets}/images/icons/next.png
  54. BIN railties/guides/{ → assets}/images/icons/note.png
  55. BIN railties/guides/{ → assets}/images/icons/prev.png
  56. BIN railties/guides/{ → assets}/images/icons/tip.png
  57. BIN railties/guides/{ → assets}/images/icons/up.png
  58. BIN railties/guides/{ → assets}/images/icons/warning.png
  59. BIN railties/guides/assets/images/jaimeiniesta.jpg
  60. BIN railties/guides/{ → assets}/images/nav_arrow.gif
  61. BIN railties/guides/{ → assets}/images/polymorphic.png
  62. BIN railties/guides/{ → assets}/images/posts_index.png
  63. BIN railties/guides/{ → assets}/images/rails_guides_logo.gif
  64. BIN railties/guides/{ → assets}/images/rails_logo_remix.gif
  65. BIN railties/guides/{ → assets}/images/rails_welcome.png
  66. BIN railties/guides/{ → assets}/images/session_fixation.png
  67. BIN railties/guides/{ → assets}/images/tab_grey.gif
  68. BIN railties/guides/{ → assets}/images/tab_info.gif
  69. BIN railties/guides/{ → assets}/images/tab_note.gif
  70. BIN railties/guides/{ → assets}/images/tab_red.gif
  71. BIN railties/guides/{ → assets}/images/tab_yellow.gif
  72. BIN railties/guides/{ → assets}/images/tab_yellow.png
  73. BIN railties/guides/{ → assets}/images/validation_error_messages.png
  74. 0 railties/guides/{files → assets}/javascripts/code_highlighter.js
  75. 0 railties/guides/{files → assets}/javascripts/guides.js
  76. 0 railties/guides/{files → assets}/javascripts/highlighters.js
  77. +14 −14 railties/guides/{files → assets}/stylesheets/main.css
  78. 0 railties/guides/{files → assets}/stylesheets/print.css
  79. 0 railties/guides/{files → assets}/stylesheets/reset.css
  80. 0 railties/guides/{files → assets}/stylesheets/style.css
  81. 0 railties/guides/{files → assets}/stylesheets/syntax.css
  82. +24 −26 railties/guides/rails_guides/generator.rb
  83. +1 −1 railties/guides/source/action_view_overview.textile
  84. +3 −3 railties/guides/source/active_support_core_extensions.textile
  85. +1 −1 railties/guides/source/contribute.textile
  86. +18 −12 railties/guides/source/credits.html.erb
  87. +2 −1 railties/guides/source/debugging_rails_applications.textile
  88. +1 −1 railties/guides/source/form_helpers.textile
  89. +1 −0 railties/guides/source/getting_started.textile
  90. +6 −6 railties/guides/source/layout.html.erb
  91. +3 −2 railties/guides/source/layouts_and_rendering.textile
  92. +4 −4 railties/guides/source/performance_testing.textile
  93. +15 −14 railties/guides/source/plugins.textile
  94. +3 −3 railties/guides/source/routing.textile
  95. +5 −5 railties/guides/source/security.textile
  96. +2 −1 railties/guides/source/testing.textile
@@ -6,7 +6,7 @@ module ActionController
# the view actions to a higher logical level. Example:
#
# # routes
- # map.resources :posts
+ # resources :posts
#
# # view
# <% div_for(post) do %> <div id="post_45" class="post">
@@ -63,7 +63,7 @@ module Routing
# named routes. For example, suppose that you have a 'users' resource in your
# <b>routes.rb</b>:
#
- # map.resources :users
+ # resources :users
#
# This generates, among other things, the method <tt>users_path</tt>. By default,
# this method is accessible from your controllers, views and mailers. If you need
@@ -9,8 +9,8 @@ module AtomFeedHelper
#
# config/routes.rb:
# Basecamp::Application.routes.draw do |map|
- # map.resources :posts
- # map.root :controller => "posts"
+ # resources :posts
+ # root :to => "posts#index"
# end
#
# app/controllers/posts_controller.rb:
@@ -121,7 +121,7 @@ module FormHelper
# The generic way to call +form_for+ yields a form builder around a
# model:
#
- # <%= form_for :person, :url => { :action => "update" } do |f| %>
+ # <%= form_for :person, :url => { :action => "create" } do |f| %>
# <%= f.error_messages %>
# First name: <%= f.text_field :first_name %><br />
# Last name : <%= f.text_field :last_name %><br />
@@ -145,7 +145,7 @@ module FormHelper
# If the instance variable is not <tt>@person</tt> you can pass the actual
# record as the second argument:
#
- # <%= form_for :person, person, :url => { :action => "update" } do |f| %>
+ # <%= form_for :person, person, :url => { :action => "create" } do |f| %>
# ...
# <% end %>
#
@@ -177,7 +177,7 @@ module FormHelper
# possible to use both the stand-alone FormHelper methods and methods
# from FormTagHelper. For example:
#
- # <%= form_for :person, @person, :url => { :action => "update" } do |f| %>
+ # <%= form_for :person, @person, :url => { :action => "create" } do |f| %>
# First name: <%= f.text_field :first_name %>
# Last name : <%= f.text_field :last_name %>
# Biography : <%= text_area :person, :biography %>
@@ -265,7 +265,7 @@ module FormHelper
# custom builder. For example, let's say you made a helper to
# automatically add labels to form inputs.
#
- # <%= form_for :person, @person, :url => { :action => "update" }, :builder => LabellingFormBuilder do |f| %>
+ # <%= form_for :person, @person, :url => { :action => "create" }, :builder => LabellingFormBuilder do |f| %>
# <%= f.text_field :first_name %>
# <%= f.text_field :last_name %>
# <%= text_area :person, :biography %>
@@ -342,7 +342,7 @@ def apply_form_for_options!(object_or_array, options) #:nodoc:
#
# === Generic Examples
#
- # <%= form_for @person, :url => { :action => "update" } do |person_form| %>
+ # <%= form_for @person do |person_form| %>
# First name: <%= person_form.text_field :first_name %>
# Last name : <%= person_form.text_field :last_name %>
#
@@ -354,13 +354,13 @@ def apply_form_for_options!(object_or_array, options) #:nodoc:
# ...or if you have an object that needs to be represented as a different
# parameter, like a Client that acts as a Person:
#
- # <%= fields_for :person, @client do |permission_fields| %>
+ # <%= fields_for :person, @client, :url => { :action => "create" } do |permission_fields| %>
# Admin?: <%= permission_fields.check_box :admin %>
# <% end %>
#
# ...or if you don't have an object, just a name of the parameter:
#
- # <%= fields_for :person do |permission_fields| %>
+ # <%= fields_for :person, :url => { :action => "create" } do |permission_fields| %>
# Admin?: <%= permission_fields.check_box :admin %>
# <% end %>
#
@@ -404,7 +404,7 @@ def apply_form_for_options!(object_or_array, options) #:nodoc:
#
# This model can now be used with a nested fields_for, like so:
#
- # <%= form_for @person, :url => { :action => "update" } do |person_form| %>
+ # <%= form_for @person do |person_form| %>
# ...
# <%= person_form.fields_for :address do |address_fields| %>
# Street : <%= address_fields.text_field :street %>
@@ -433,7 +433,7 @@ def apply_form_for_options!(object_or_array, options) #:nodoc:
# with a value that evaluates to +true+, you will destroy the associated
# model (eg. 1, '1', true, or 'true'):
#
- # <%= form_for @person, :url => { :action => "update" } do |person_form| %>
+ # <%= form_for @person do |person_form| %>
# ...
# <%= person_form.fields_for :address do |address_fields| %>
# ...
@@ -461,7 +461,7 @@ def apply_form_for_options!(object_or_array, options) #:nodoc:
# the nested fields_for call will be repeated for each instance in the
# collection:
#
- # <%= form_for @person, :url => { :action => "update" } do |person_form| %>
+ # <%= form_for @person do |person_form| %>
# ...
# <%= person_form.fields_for :projects do |project_fields| %>
# <% if project_fields.object.active? %>
@@ -472,7 +472,7 @@ def apply_form_for_options!(object_or_array, options) #:nodoc:
#
# It's also possible to specify the instance to be used:
#
- # <%= form_for @person, :url => { :action => "update" } do |person_form| %>
+ # <%= form_for @person do |person_form| %>
# ...
# <% @person.projects.each do |project| %>
# <% if project.active? %>
@@ -485,7 +485,7 @@ def apply_form_for_options!(object_or_array, options) #:nodoc:
#
# Or a collection to be used:
#
- # <%= form_for @person, :url => { :action => "update" } do |person_form| %>
+ # <%= form_for @person do |person_form| %>
# ...
# <%= person_form.fields_for :projects, @active_projects do |project_fields| %>
# Name: <%= project_fields.text_field :name %>
@@ -514,7 +514,7 @@ def apply_form_for_options!(object_or_array, options) #:nodoc:
# parameter with a value that evaluates to +true+
# (eg. 1, '1', true, or 'true'):
#
- # <%= form_for @person, :url => { :action => "update" } do |person_form| %>
+ # <%= form_for @person do |person_form| %>
# ...
# <%= person_form.fields_for :projects do |project_fields| %>
# Delete: <%= project_fields.check_box :_destroy %>
@@ -1572,7 +1572,7 @@ def initialize_copy(other)
# or nil if this record's unsaved.
#
# For example, suppose that you have a User model, and that you have a
- # <tt>map.resources :users</tt> route. Normally, +user_path+ will
+ # <tt>resources :users</tt> route. Normally, +user_path+ will
# construct a path with the user object's 'id' in it:
#
# user = User.find_by_name('Phusion')
Diff not rendered.
@@ -92,15 +92,15 @@ body {
}
#header {
- background: #c52f24 url(../../images/header_tile.gif) repeat-x;
+ background: #c52f24 url(../images/header_tile.gif) repeat-x;
color: #FFF;
padding: 1.5em 0;
position: relative;
z-index: 99;
}
#feature {
- background: #d5e9f6 url(../../images/feature_tile.gif) repeat-x;
+ background: #d5e9f6 url(../images/feature_tile.gif) repeat-x;
color: #333;
padding: 0.5em 0 1.5em;
}
@@ -132,7 +132,7 @@ body {
#footer {
padding: 2em 0;
- background: url(../../images/footer_tile.gif) repeat-x;
+ background: url(../images/footer_tile.gif) repeat-x;
}
#footer .wrapper {
padding-left: 2em;
@@ -179,7 +179,7 @@ a, a:link, a:visited {
}
#header .nav .index a {
- background: #980905 url(../../images/nav_arrow.gif) no-repeat right top;
+ background: #980905 url(../images/nav_arrow.gif) no-repeat right top;
padding-right: 1em;
position: relative;
z-index: 15;
@@ -285,7 +285,7 @@ h6 {
#header h1 {
float: left;
- background: url(../../images/rails_guides_logo.gif) no-repeat;
+ background: url(../images/rails_guides_logo.gif) no-repeat;
width: 297px;
text-indent: -9999em;
margin: 0;
@@ -306,7 +306,7 @@ h6 {
#feature ul {margin-left: 0;}
#feature ul li {
list-style: none;
- background: url(../../images/check_bullet.gif) no-repeat left 0.5em;
+ background: url(../images/check_bullet.gif) no-repeat left 0.5em;
padding: 0.5em 1.75em 0.5em 1.75em;
font-size: 1.1428em;
font-weight: bold;
@@ -325,20 +325,20 @@ h6 {
font-size: 1.2857em;
padding: 0.125em 0 0.25em 0;
margin-bottom: 0;
- /*background: url(../../images/book_icon.gif) no-repeat left top;
+ /*background: url(../images/book_icon.gif) no-repeat left top;
padding: 0.125em 0 0.25em 28px;*/
}
#mainCol dd.ticket, #subCol dd.ticket {
- background: #fff9d8 url(../../images/tab_yellow.gif) no-repeat left top;
+ background: #fff9d8 url(../images/tab_yellow.gif) no-repeat left top;
border: none;
padding: 1.25em 1em 1.25em 48px;
margin-left: 0;
margin-top: 0.25em;
}
#mainCol div.warning, #subCol dd.warning {
- background: #f9d9d8 url(../../images/tab_red.gif) no-repeat left top;
+ background: #f9d9d8 url(../images/tab_red.gif) no-repeat left top;
border: none;
padding: 1.25em 1.25em 1.25em 48px;
margin-left: 0;
@@ -355,7 +355,7 @@ h6 {
#subCol .chapters ul li {
list-style: none;
padding: 0 0 0 1em;
- background: url(../../images/bullet.gif) no-repeat left 0.45em;
+ background: url(../images/bullet.gif) no-repeat left 0.45em;
margin-left: 0;
font-size: 1em;
font-weight: normal;
@@ -366,7 +366,7 @@ tt {
}
div.code_container {
- background: #EEE url(../../images/tab_grey.gif) no-repeat left top;
+ background: #EEE url(../images/tab_grey.gif) no-repeat left top;
padding: 0.25em 1em 0.5em 48px;
}
@@ -378,14 +378,14 @@ code {
}
.note {
- background: #fff9d8 url(../../images/tab_note.gif) no-repeat left top;
+ background: #fff9d8 url(../images/tab_note.gif) no-repeat left top;
border: none;
padding: 1em 1em 0.25em 48px;
margin: 0.25em 0 1.5em 0;
}
.info {
- background: #d5e9f6 url(../../images/tab_info.gif) no-repeat left top;
+ background: #d5e9f6 url(../images/tab_info.gif) no-repeat left top;
border: none;
padding: 1em 1em 0.25em 48px;
margin: 0.25em 0 1.5em 0;
@@ -395,7 +395,7 @@ code {
#mainCol ul li {
list-style:none;
- background: url(../../images/grey_bullet.gif) no-repeat left 0.5em;
+ background: url(../images/grey_bullet.gif) no-repeat left 0.5em;
padding-left: 1em;
margin-left: 0;
}
@@ -9,27 +9,23 @@
#
# Some arguments may be passed via environment variables:
#
-# WARN_BROKEN_LINKS
-# Internal references (anchors) are checked. If a reference is broken
-# levenshtein distance is used to suggest an existing one. This is useful
-# since IDs are generated by Textile from titles and thus rewordings alter
-# them.
+# WARNINGS
+# If you are writing a guide, please work always with WARNINGS=1. Users can
+# generate the guides, and thus this flag is off by default.
#
-# WARN_DUPLICATE_HEADERS
-# Warns about duplicate IDs in headers. Please do resolve them, if any,
-# so guides are valid XHTML.
+# Internal links (anchors) are checked. If a reference is broken levenshtein
+# distance is used to suggest an existing one. This is useful since IDs are
+# generated by Textile from headers and thus edits alter them.
#
-# This check only happens if WARN_BROKEN_LINKS is also active.
-#
-# EDGE_GUIDES
-# Set to "1" to indicate edge guides are generated.
+# Also detects duplicated IDs. They happen if there are headers with the same
+# text. Please do resolve them, if any, so guides are valid XHTML.
#
# ALL
-# Generate all guides.
-
+# Set to "1" to force the generation of all guides.
+#
# ONLY
-# If you want to generate only one or a set of guides.
-# Prefixes are enough:
+# Use ONLY if you want to generate only one or a set of guides. Prefixes are
+# enough:
#
# # generates only association_basics.html
# ONLY=assoc ruby rails_guides.rb
@@ -39,9 +35,12 @@
# # generates only
# ONLY=assoc,migrations ruby rails_guides.rb
#
-# Note that if you are working on a guide, generation will
-# by default process only that one, so ONLY is rarely used
-# nowadays.
+# Note that if you are working on a guide generation will by default process
+# only that one, so ONLY is rarely used nowadays.
+#
+# EDGE
+# Set to "1" to indicate generated guides should be marked as edge. This
+# inserts a badge and changes the preamble of the home page.
#
# ---------------------------------------------------------------------------
@@ -85,7 +84,7 @@ def create_output_dir_if_needed
end
def set_edge
- @edge = ENV['EDGE_GUIDES'] == '1'
+ @edge = ENV['EDGE'] == '1'
end
def generate_guides
@@ -97,19 +96,18 @@ def generate_guides
def guides_to_generate
guides = Dir.entries(source_dir).grep(GUIDES_RE)
- ENV.key?("ONLY") ? select_only(guides) : guides
+ ENV.key?('ONLY') ? select_only(guides) : guides
end
def select_only(guides)
- prefixes = ENV["ONLY"].split(",").map(&:strip)
+ prefixes = ENV['ONLY'].split(",").map(&:strip)
guides.select do |guide|
prefixes.any? {|p| guide.start_with?(p)}
end
end
def copy_assets
- FileUtils.cp_r(File.join(guides_dir, 'images'), output_dir)
- FileUtils.cp_r(File.join(guides_dir, 'files'), output_dir)
+ FileUtils.cp_r(Dir.glob("#{guides_dir}/assets/*"), output_dir)
end
def output_file_for(guide)
@@ -138,7 +136,7 @@ def generate_guide(guide, output_file)
result = view.render(:layout => 'layout', :text => textile(body))
- warn_about_broken_links(result) if ENV.key?("WARN_BROKEN_LINKS")
+ warn_about_broken_links(result) if ENV['WARNINGS'] == '1'
end
f.write result
@@ -229,7 +227,7 @@ def extract_anchors(html)
anchors = Set.new
html.scan(/<h\d\s+id="([^"]+)/).flatten.each do |anchor|
if anchors.member?(anchor)
- puts "*** DUPLICATE HEADER ID: #{anchor}, please consider rewording" if ENV.key?("WARN_DUPLICATE_HEADERS")
+ puts "*** DUPLICATE ID: #{anchor}, please put and explicit ID, e.g. h4(#explicit-id), or consider rewording"
else
anchors << anchor
end
@@ -1414,7 +1414,7 @@ Replaces the inner HTML of the DOM element with the given id.
page.replace_html 'person-45', :partial => 'person', :object => @person
</ruby>
-h5. select
+h5(#prototype-select). select
Returns a collection reference by finding it through a CSS pattern in the DOM.
Oops, something went wrong.

0 comments on commit 723e91e

Please sign in to comment.