rails 2.3.8 → 2.3.9.pre

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rails might be problematic. Click here for more details.

Files changed (119) hide show
  1. data/CHANGELOG +3 -2
  2. data/Rakefile +6 -7
  3. data/builtin/rails_info/rails/info.rb +1 -1
  4. data/environments/boot.rb +6 -2
  5. data/environments/environment.rb +1 -1
  6. data/lib/initializer.rb +44 -20
  7. data/lib/rails/plugin.rb +1 -1
  8. data/lib/rails/plugin/loader.rb +3 -3
  9. data/lib/rails/version.rb +1 -1
  10. data/lib/rails_generator/generators/components/migration/migration_generator.rb +1 -1
  11. data/lib/rails_generator/generators/components/plugin/templates/test_helper.rb +2 -1
  12. metadata +25 -124
  13. data/guides/files/javascripts/code_highlighter.js +0 -188
  14. data/guides/files/javascripts/guides.js +0 -8
  15. data/guides/files/javascripts/highlighters.js +0 -90
  16. data/guides/files/stylesheets/main.css +0 -441
  17. data/guides/files/stylesheets/print.css +0 -52
  18. data/guides/files/stylesheets/reset.css +0 -43
  19. data/guides/files/stylesheets/style.css +0 -13
  20. data/guides/files/stylesheets/syntax.css +0 -31
  21. data/guides/images/belongs_to.png +0 -0
  22. data/guides/images/book_icon.gif +0 -0
  23. data/guides/images/bullet.gif +0 -0
  24. data/guides/images/chapters_icon.gif +0 -0
  25. data/guides/images/check_bullet.gif +0 -0
  26. data/guides/images/credits_pic_blank.gif +0 -0
  27. data/guides/images/csrf.png +0 -0
  28. data/guides/images/customized_error_messages.png +0 -0
  29. data/guides/images/error_messages.png +0 -0
  30. data/guides/images/feature_tile.gif +0 -0
  31. data/guides/images/footer_tile.gif +0 -0
  32. data/guides/images/fxn.jpg +0 -0
  33. data/guides/images/grey_bullet.gif +0 -0
  34. data/guides/images/habtm.png +0 -0
  35. data/guides/images/has_many.png +0 -0
  36. data/guides/images/has_many_through.png +0 -0
  37. data/guides/images/has_one.png +0 -0
  38. data/guides/images/has_one_through.png +0 -0
  39. data/guides/images/header_backdrop.png +0 -0
  40. data/guides/images/header_tile.gif +0 -0
  41. data/guides/images/i18n/demo_localized_pirate.png +0 -0
  42. data/guides/images/i18n/demo_translated_en.png +0 -0
  43. data/guides/images/i18n/demo_translated_pirate.png +0 -0
  44. data/guides/images/i18n/demo_translation_missing.png +0 -0
  45. data/guides/images/i18n/demo_untranslated.png +0 -0
  46. data/guides/images/icons/README +0 -5
  47. data/guides/images/icons/callouts/1.png +0 -0
  48. data/guides/images/icons/callouts/10.png +0 -0
  49. data/guides/images/icons/callouts/11.png +0 -0
  50. data/guides/images/icons/callouts/12.png +0 -0
  51. data/guides/images/icons/callouts/13.png +0 -0
  52. data/guides/images/icons/callouts/14.png +0 -0
  53. data/guides/images/icons/callouts/15.png +0 -0
  54. data/guides/images/icons/callouts/2.png +0 -0
  55. data/guides/images/icons/callouts/3.png +0 -0
  56. data/guides/images/icons/callouts/4.png +0 -0
  57. data/guides/images/icons/callouts/5.png +0 -0
  58. data/guides/images/icons/callouts/6.png +0 -0
  59. data/guides/images/icons/callouts/7.png +0 -0
  60. data/guides/images/icons/callouts/8.png +0 -0
  61. data/guides/images/icons/callouts/9.png +0 -0
  62. data/guides/images/icons/caution.png +0 -0
  63. data/guides/images/icons/example.png +0 -0
  64. data/guides/images/icons/home.png +0 -0
  65. data/guides/images/icons/important.png +0 -0
  66. data/guides/images/icons/next.png +0 -0
  67. data/guides/images/icons/note.png +0 -0
  68. data/guides/images/icons/prev.png +0 -0
  69. data/guides/images/icons/tip.png +0 -0
  70. data/guides/images/icons/up.png +0 -0
  71. data/guides/images/icons/warning.png +0 -0
  72. data/guides/images/nav_arrow.gif +0 -0
  73. data/guides/images/polymorphic.png +0 -0
  74. data/guides/images/posts_index.png +0 -0
  75. data/guides/images/rails_guides_logo.gif +0 -0
  76. data/guides/images/rails_logo_remix.gif +0 -0
  77. data/guides/images/rails_welcome.png +0 -0
  78. data/guides/images/session_fixation.png +0 -0
  79. data/guides/images/tab_grey.gif +0 -0
  80. data/guides/images/tab_info.gif +0 -0
  81. data/guides/images/tab_note.gif +0 -0
  82. data/guides/images/tab_red.gif +0 -0
  83. data/guides/images/tab_yellow.gif +0 -0
  84. data/guides/images/tab_yellow.png +0 -0
  85. data/guides/images/validation_error_messages.png +0 -0
  86. data/guides/rails_guides.rb +0 -42
  87. data/guides/rails_guides/generator.rb +0 -138
  88. data/guides/rails_guides/helpers.rb +0 -34
  89. data/guides/rails_guides/indexer.rb +0 -55
  90. data/guides/rails_guides/textile_extensions.rb +0 -41
  91. data/guides/source/2_2_release_notes.textile +0 -422
  92. data/guides/source/2_3_release_notes.textile +0 -610
  93. data/guides/source/action_controller_overview.textile +0 -776
  94. data/guides/source/action_mailer_basics.textile +0 -424
  95. data/guides/source/active_record_basics.textile +0 -135
  96. data/guides/source/active_record_querying.textile +0 -969
  97. data/guides/source/activerecord_validations_callbacks.textile +0 -1086
  98. data/guides/source/association_basics.textile +0 -1781
  99. data/guides/source/caching_with_rails.textile +0 -524
  100. data/guides/source/command_line.textile +0 -589
  101. data/guides/source/configuring.textile +0 -234
  102. data/guides/source/contribute.textile +0 -71
  103. data/guides/source/contributing_to_rails.textile +0 -239
  104. data/guides/source/credits.erb.textile +0 -52
  105. data/guides/source/debugging_rails_applications.textile +0 -709
  106. data/guides/source/form_helpers.textile +0 -766
  107. data/guides/source/getting_started.textile +0 -1297
  108. data/guides/source/i18n.textile +0 -912
  109. data/guides/source/index.erb.textile +0 -124
  110. data/guides/source/layout.html.erb +0 -103
  111. data/guides/source/layouts_and_rendering.textile +0 -979
  112. data/guides/source/migrations.textile +0 -591
  113. data/guides/source/nested_model_forms.textile +0 -222
  114. data/guides/source/performance_testing.textile +0 -531
  115. data/guides/source/plugins.textile +0 -1512
  116. data/guides/source/rails_on_rack.textile +0 -309
  117. data/guides/source/routing.textile +0 -903
  118. data/guides/source/security.textile +0 -986
  119. data/guides/source/testing.textile +0 -951
@@ -1,234 +0,0 @@
1
- h2. Configuring Rails Applications
2
-
3
- This guide covers the configuration and initialization features available to Rails applications. By referring to this guide, you will be able to:
4
-
5
- * Adjust the behavior of your Rails applications
6
- * Add additional code to be run at application start time
7
-
8
- endprologue.
9
-
10
-
11
- h3. Locations for Initialization Code
12
-
13
- Rails offers (at least) five good spots to place initialization code:
14
-
15
- * Preinitializers
16
- * environment.rb
17
- * Environment-specific Configuration Files
18
- * Initializers (load_application_initializers)
19
- * After-Initializers
20
-
21
- h3. Using a Preinitializer
22
-
23
- Rails allows you to use a preinitializer to run code before the framework itself is loaded. If you save code in +RAILS_ROOT/config/preinitializer.rb+, that code will be the first thing loaded, before any of the framework components (Active Record, Action Pack, and so on.) If you want to change the behavior of one of the classes that is used in the initialization process, you can do so in this file.
24
-
25
- h3. Configuring Rails Components
26
-
27
- In general, the work of configuring Rails means configuring the components of Rails, as well as configuring Rails itself. The +environment.rb+ and environment-specific configuration files (such as +config/environments/production.rb+) allow you to specify the various settings that you want to pass down to all of the components. For example, the default Rails 2.3 +environment.rb+ file includes one setting:
28
-
29
- <ruby>
30
- config.time_zone = 'UTC'
31
- </ruby>
32
-
33
- This is a setting for Rails itself. If you want to pass settings to individual Rails components, you can do so via the same +config+ object:
34
-
35
- <ruby>
36
- config.active_record.colorize_logging = false
37
- </ruby>
38
-
39
- Rails will use that particular setting to configure Active Record.
40
-
41
- h4. Configuring Active Record
42
-
43
- <tt>ActiveRecord::Base</tt> includes a variety of configuration options:
44
-
45
- * +logger+ accepts a logger conforming to the interface of Log4r or the default Ruby 1.8.x Logger class, which is then passed on to any new database connections made. You can retrieve this logger by calling +logger+ on either an ActiveRecord model class or an ActiveRecord model instance. Set to nil to disable logging.
46
-
47
- * +primary_key_prefix_type+ lets you adjust the naming for primary key columns. By default, Rails assumes that primary key columns are named +id+ (and this configuration option doesn't need to be set.) There are two other choices:
48
- ** +:table_name+ would make the primary key for the Customer class +customerid+
49
- ** +:table_name_with_underscore+ would make the primary key for the Customer class +customer_id+
50
-
51
- * +table_name_prefix+ lets you set a global string to be prepended to table names. If you set this to +northwest_+, then the Customer class will look for +northwest_customers+ as its table. The default is an empty string.
52
-
53
- * +table_name_suffix+ lets you set a global string to be appended to table names. If you set this to +_northwest+, then the Customer class will look for +customers_northwest+ as its table. The default is an empty string.
54
-
55
- * +pluralize_table_names+ specifies whether Rails will look for singular or plural table names in the database. If set to +true+ (the default), then the Customer class will use the +customers+ table. If set to +false+, then the Customers class will use the +customer+ table.
56
-
57
- * +colorize_logging+ (true by default) specifies whether or not to use ANSI color codes when logging information from ActiveRecord.
58
-
59
- * +default_timezone+ determines whether to use +Time.local+ (if set to +:local+) or +Time.utc+ (if set to +:utc+) when pulling dates and times from the database. The default is +:local+.
60
-
61
- * +schema_format+ controls the format for dumping the database schema to a file. The options are +:ruby+ (the default) for a database-independent version that depends on migrations, or +:sql+ for a set of (potentially database-dependent) SQL statements.
62
-
63
- * +timestamped_migrations+ controls whether migrations are numbered with serial integers or with timestamps. The default is +true+, to use timestamps, which are preferred if there are multiple developers working on the same application.
64
-
65
- * +lock_optimistically+ controls whether ActiveRecord will use optimistic locking. By default this is +true+.
66
-
67
- The MySQL adapter adds one additional configuration option:
68
-
69
- * +ActiveRecord::ConnectionAdapters::MysqlAdapter.emulate_booleans+ controls whether ActiveRecord will consider all +tinyint(1)+ columns in a MySQL database to be booleans. By default this is +true+.
70
-
71
- The schema dumper adds one additional configuration option:
72
-
73
- * +ActiveRecord::SchemaDumper.ignore_tables+ accepts an array of tables that should _not_ be included in any generated schema file. This setting is ignored unless +ActiveRecord::Base.schema_format == :ruby+.
74
-
75
- h4. Configuring Action Controller
76
-
77
- <tt>ActionController::Base</tt> includes a number of configuration settings:
78
-
79
- * +asset_host+ provides a string that is prepended to all of the URL-generating helpers in +AssetHelper+. This is designed to allow moving all javascript, CSS, and image files to a separate asset host.
80
-
81
- * +consider_all_requests_local+ is generally set to +true+ during development and +false+ during production; if it is set to +true+, then any error will cause detailed debugging information to be dumped in the HTTP response. For finer-grained control, set this to +false+ and implement +local_request?+ to specify which requests should provide debugging information on errors.
82
-
83
- * +allow_concurrency+ should be set to +true+ to allow concurrent (threadsafe) action processing. Set to +false+ by default. You probably don't want to call this one directly, though, because a series of other adjustments need to be made for threadsafe mode to work properly. Instead, you should simply call +config.threadsafe!+ inside your +production.rb+ file, which makes all the necessary adjustments.
84
-
85
- WARNING: Threadsafe operation in incompatible with the normal workings of development mode Rails. In particular, automatic dependency loading and class reloading are automatically disabled when you call +config.threadsafe!+.
86
-
87
- * +param_parsers+ provides an array of handlers that can extract information from incoming HTTP requests and add it to the +params+ hash. By default, parsers for multipart forms, URL-encoded forms, XML, and JSON are active.
88
-
89
- * +default_charset+ specifies the default character set for all renders. The default is "utf-8".
90
-
91
- * +logger+ accepts a logger conforming to the interface of Log4r or the default Ruby 1.8+ Logger class, which is then used to log information from Action Controller. Set to nil to disable logging.
92
-
93
- * +resource_action_separator+ gives the token to be used between resources and actions when building or interpreting RESTful URLs. By default, this is "/".
94
-
95
- * +resource_path_names+ is a hash of default names for several RESTful actions. By default, the new action is named +new+ and the edit action is named +edit+.
96
-
97
- * +request_forgery_protection_token+ sets the token parameter name for RequestForgery. Calling +protect_from_forgery+ sets it to +:authenticity_token+ by default.
98
-
99
- * +optimise_named_routes+ turns on some optimizations in generating the routing table. It is set to +true+ by default.
100
-
101
- * +use_accept_header+ sets the rules for determining the response format. If this is set to +true+ (the default) then +respond_to+ and +Request#format+ will take the Accept header into account. If it is set to false then the request format will be determined solely by examining +params[:format]+. If there is no +format+ parameter, then the response format will be either HTML or Javascript depending on whether the request is an AJAX request.
102
-
103
- * +allow_forgery_protection+ enables or disables CSRF protection. By default this is +false+ in test mode and +true+ in all other modes.
104
-
105
- * +relative_url_root+ can be used to tell Rails that you are deploying to a subdirectory. The default is +ENV['RAILS_RELATIVE_URL_ROOT']+.
106
-
107
- The caching code adds two additional settings:
108
-
109
- * +ActionController::Caching::Pages.page_cache_directory+ sets the directory where Rails will create cached pages for your web server. The default is +Rails.public_path+ (which is usually set to +RAILS_ROOT + "/public"+).
110
-
111
- * +ActionController::Caching::Pages.page_cache_extension+ sets the extension to be used when generating pages for the cache (this is ignored if the incoming request already has an extension). The default is +.html+.
112
-
113
- The dispatcher includes one setting:
114
-
115
- * +ActionController::Dispatcher.error_file_path+ gives the path where Rails will look for error files such as +404.html+. The default is +Rails.public_path+.
116
-
117
- The Active Record session store can also be configured:
118
-
119
- * +CGI::Session::ActiveRecordStore::Session.data_column_name+ sets the name of the column to use to store session data. By default it is 'data'
120
-
121
- h4. Configuring Action View
122
-
123
- There are only a few configuration options for Action View, starting with four on +ActionView::Base+:
124
-
125
- * +debug_rjs+ specifies whether RJS responses should be wrapped in a try/catch block that alert()s the caught exception (and then re-raises it). The default is +false+.
126
-
127
- * +warn_cache_misses+ tells Rails to display a warning whenever an action results in a cache miss on your view paths. The default is +false+.
128
-
129
- * +field_error_proc+ provides an HTML generator for displaying errors that come from Active Record. The default is <tt>Proc.new{ |html_tag, instance| "<div class=\"fieldWithErrors\">#{html_tag}</div>" }</tt>
130
-
131
- * +default_form_builder+ tells Rails which form builder to use by default. The default is +ActionView::Helpers::FormBuilder+.
132
-
133
- The ERB template handler supplies one additional option:
134
-
135
- * +ActionView::TemplateHandlers::ERB.erb_trim_mode+ gives the trim mode to be used by ERB. It defaults to +'-'+. See the "ERB documentation":http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/ for more information.
136
-
137
- h4. Configuring Action Mailer
138
-
139
- There are a number of settings available on +ActionMailer::Base+:
140
-
141
- * +template_root+ gives the root folder for Action Mailer templates.
142
-
143
- * +logger+ accepts a logger conforming to the interface of Log4r or the default Ruby 1.8+ Logger class, which is then used to log information from Action Mailer. Set to nil to disable logging.
144
-
145
- * +smtp_settings+ allows detailed configuration for the +:smtp+ delivery method. It accepts a hash of options, which can include any of these options:
146
- ** +:address+ - Allows you to use a remote mail server. Just change it from its default "localhost" setting.
147
- ** +:port+ - On the off chance that your mail server doesn't run on port 25, you can change it.
148
- ** +:domain+ - If you need to specify a HELO domain, you can do it here.
149
- ** +:user_name+ - If your mail server requires authentication, set the username in this setting.
150
- ** +:password+ - If your mail server requires authentication, set the password in this setting.
151
- ** +:authentication+ - If your mail server requires authentication, you need to specify the authentication type here. This is a symbol and one of +:plain+, +:login+, +:cram_md5+.
152
-
153
- * +sendmail_settings+ allows detailed configuration for the +sendmail+ delivery method. It accepts a hash of options, which can include any of these options:
154
- ** +:location+ - The location of the sendmail executable. Defaults to +/usr/sbin/sendmail+.
155
- ** +:arguments+ - The command line arguments. Defaults to +-i -t+.
156
-
157
- * +raise_delivery_errors+ specifies whether to raise an error if email delivery cannot be completed. It defaults to +true+.
158
-
159
- * +delivery_method+ defines the delivery method. The allowed values are +:smtp+ (default), +:sendmail+, and +:test+.
160
-
161
- * +perform_deliveries+ specifies whether mail will actually be delivered. By default this is +true+; it can be convenient to set it to +false+ for testing.
162
-
163
- * +default_charset+ tells Action Mailer which character set to use for the body and for encoding the subject. It defaults to +utf-8+.
164
-
165
- * +default_content_type+ specifies the default content type used for the main part of the message. It defaults to "text/plain"
166
-
167
- * +default_mime_version+ is the default MIME version for the message. It defaults to +1.0+.
168
-
169
- * +default_implicit_parts_order+ - When a message is built implicitly (i.e. multiple parts are assembled from templates
170
- which specify the content type in their filenames) this variable controls how the parts are ordered. Defaults to +["text/html", "text/enriched", "text/plain"]+. Items that appear first in the array have higher priority in the mail client
171
- and appear last in the mime encoded message.
172
-
173
- h4. Configuring Active Resource
174
-
175
- There is a single configuration setting available on +ActiveResource::Base+:
176
-
177
- <tt>logger</tt> accepts a logger conforming to the interface of Log4r or the default Ruby 1.8+ Logger class, which is then used to log information from Active Resource. Set to nil to disable logging.
178
-
179
- h4. Configuring Active Support
180
-
181
- There are a few configuration options available in Active Support:
182
-
183
- * +ActiveSupport::BufferedLogger.silencer+ is set to +false+ to disable the ability to silence logging in a block. The default is +true+.
184
-
185
- * +ActiveSupport::Cache::Store.logger+ specifies the logger to use within cache store operations.
186
-
187
- * +ActiveSupport::Logger.silencer+ is set to +false+ to disable the ability to silence logging in a block. The default is +true+.
188
-
189
- h4. Configuring Active Model
190
-
191
- Active Model currently has a single configuration setting:
192
-
193
- * +ActiveModel::Errors.default_error_messages+ is an array containing all of the validation error messages.
194
-
195
- h3. Using Initializers
196
-
197
- After it loads the framework plus any gems and plugins in your application, Rails turns to loading initializers. An initializer is any file of ruby code stored under +/config/initializers+ in your application. You can use initializers to hold configuration settings that should be made after all of the frameworks and plugins are loaded.
198
-
199
- NOTE: You can use subfolders to organize your initializers if you like, because Rails will look into the whole file hierarchy from the +initializers+ folder on down.
200
-
201
- TIP: If you have any ordering dependency in your initializers, you can control the load order by naming. For example, +01_critical.rb+ will be loaded before +02_normal.rb+.
202
-
203
- h3. Using an After-Initializer
204
-
205
- After-initializers are run (as you might guess) after any initializers are loaded. You can supply an +after_initialize+ block (or an array of such blocks) by setting up +config.after_initialize+ in any of the Rails configuration files:
206
-
207
- <ruby>
208
- config.after_initialize do
209
- SomeClass.init
210
- end
211
- </ruby>
212
-
213
- WARNING: Some parts of your application, notably observers and routing, are not yet set up at the point where the +after_initialize+ block is called.
214
-
215
- h3. Rails Environment Settings
216
-
217
- Some parts of Rails can also be configured externally by supplying environment variables. The following environment variables are recognized by various parts of Rails:
218
-
219
- * +ENV['RAILS_ENV']+ defines the Rails environment (production, development, test, and so on) that Rails will run under.
220
-
221
- * +ENV['RAILS_RELATIVE_URL_ROOT']+ is used by the routing code to recognize URLs when you deploy your application to a subdirectory.
222
-
223
- * +ENV["RAILS_ASSET_ID"]+ will override the default cache-busting timestamps that Rails generates for downloadable assets.
224
-
225
- * +ENV["RAILS_CACHE_ID"]+ and +ENV["RAILS_APP_VERSION"]+ are used to generate expanded cache keys in Rails' caching code. This allows you to have multiple separate caches from the same application.
226
-
227
- * +ENV['RAILS_GEM_VERSION']+ defines the version of the Rails gems to use, if +RAILS_GEM_VERSION+ is not defined in your +environment.rb+ file.
228
-
229
- h3. Changelog
230
-
231
- "Lighthouse ticket":http://rails.lighthouseapp.com/projects/16213-rails-guides/tickets/28
232
-
233
- * January 3, 2009: First reasonably complete draft by "Mike Gunderloy":credits.html#mgunderloy
234
- * November 5, 2008: Rough outline by "Mike Gunderloy":credits.html#mgunderloy
@@ -1,71 +0,0 @@
1
- h2. Contribute to the Rails Guides
2
-
3
- Rails Guides aim to improve the Rails documentation and to make the barrier to entry as low as possible. A reasonably experienced developer should be able to use the Guides to come up to speed on Rails quickly. You can track the overall effort at the "Rails Guides Lighthouse":http://rails.lighthouseapp.com/projects/16213-rails-guides/tickets. Our sponsors have contributed prizes for those who write an entire guide, but there are many other ways to contribute.
4
-
5
- endprologue.
6
-
7
- h3. How to Contribute?
8
-
9
- * We have an open commit policy: anyone is welcome to contribute, but you'll need to ask for commit access.
10
- * PM lifo at "GitHub":http://github.com asking for "docrails":http://github.com/lifo/docrails/tree/master commit access.
11
- * Guides are written in Textile, and reside at railties/guides/source in the docrails project.
12
- * All images are in the railties/guides/images directory.
13
- * Sample format : "Active Record Associations":http://github.com/lifo/docrails/blob/3e56a3832415476fdd1cb963980d0ae390ac1ed3/railties/guides/source/association_basics.textile
14
- * Sample output : "Active Record Associations":http://guides.rails.info/association_basics.html
15
- * You can build the Guides during testing by running +rake guides+ in the +railties+ directory.
16
-
17
- h3. What to Contribute?
18
-
19
- * We need authors, editors, proofreaders, and translators. Adding a single paragraph of quality content to a guide is a good way to get started.
20
- * The easiest way to start is by improving an existing guide:
21
- ** Improve the structure to make it more coherent
22
- ** Add missing information
23
- ** Correct any factual errors
24
- ** Fix typos or improve style
25
- ** Bring it up to date with the latest Edge Rails
26
- * We're also open to suggestions for entire new guides
27
- ** Contact lifo or mikeg1a in IRC or via "email":mailto:MikeG1@larkfarm.com to get your idea approved
28
- ** If you're the main author on a significant guide, you're eligible for the prizes
29
-
30
- h3. How to Commit
31
-
32
- * If you have a small change or typo fix, just ask lifo for commit access and commit it to the project.
33
- * If your change is more significant, post a patch or a message on Lighthouse, and commit after you get a +1 from lifo or mikeg1a.
34
- * If the guide is already marked done, you should get a +1 before pushing your changes.
35
- * Put [#&lt;ticket number&gt;] in your commit message to enable GitHub/Lighthouse integration.
36
-
37
- h3. Prizes
38
-
39
- For each completed guide, the lead contributor will receive all of the following prizes:
40
-
41
- * $200 from Caboose Rails Documentation Project.
42
- * 1 year of GitHub Micro account worth $84.
43
- * 1 year of RPM Basic (Production performance management) for up to 10 hosts worth 12 months x $40 per host x $10 hosts = $4800. And also, savings of $45 per host per month over list price to upgrade to advanced product.
44
-
45
- h3. Rules
46
-
47
- * Guides are licensed under a Creative Commons Attribution-Share Alike 3.0 License.
48
- * If you're not sure whether a guide is actively being worked on, stop by IRC and ask.
49
- * If the same guide writer wants to write multiple guides, that's ideally the situation we'd love to be in! However, that guide writer will only receive the cash prize for all the subsequent guides (and not the GitHub or RPM prizes).
50
- * Our review team will have the final say on whether the guide is complete and of good enough quality.
51
-
52
- All authors should read and follow the "Rails Guides Conventions":http://wiki.github.com/lifo/docrails/rails-guides-conventions and the "Rails API Documentation Conventions":http://wiki.github.com/lifo/docrails/rails-api-documentation-conventions.
53
-
54
- h3. Translations
55
-
56
- The translation effort for the Rails Guides is just getting underway. We know about projects to translate the Guides into Spanish, Portuguese, Polish, and French. For more details or to get involved see the "Translating Rails Guides":http://wiki.github.com/lifo/docrails/translating-rails-guides page.
57
-
58
- h3. Mailing List
59
-
60
- "Ruby on Rails: Documentation":http://groups.google.com/group/rubyonrails-docs is the mailing list for all the guides/documentation related discussions.
61
-
62
- h3. IRC Channel
63
-
64
- ==#docrails @ irc.freenode.net==
65
-
66
- h3. Contact
67
-
68
- If you have any questions or need any clarification, feel free to contact:
69
-
70
- * IRC : lifo, mikeg1a or fxn in #docrails
71
- * Email : pratiknaik aT gmail
@@ -1,239 +0,0 @@
1
- h2. Contributing to Rails
2
-
3
- This guide covers ways in which _you_ can become a part of the ongoing development of Rails. After reading it, you should be familiar with:
4
-
5
- * Using Lighthouse to report issues with Rails
6
- * Cloning edge Rails and running the test suite
7
- * Helping to resolve existing issues
8
- * Contributing to the Rails documentation
9
- * Contributing to the Rails code
10
-
11
- Rails is not "someone else's framework." Over the years, hundreds of people have contributed code ranging from a single character to massive architectural changes, all with the goal of making Rails better for everyone. Even if you don't feel up to writing code yet, there are a variety of other ways that you can contribute, from reporting issues to testing patches to contributing documentation.
12
-
13
- endprologue.
14
-
15
- h3. Reporting a Rails Issue
16
-
17
- Rails uses a "Lighthouse project":http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/ to track issues (primarily bugs and contributions of new code). If you've found a bug in Rails, this is the place to start.
18
-
19
- NOTE: Bugs in the most recent released version of Rails are likely to get the most attention. Also, the Rails core team is always interested in feedback from those who can take the time to test _edge Rails_ (the code for the version of Rails that is currently under development). Later in this Guide you'll find out how to get edge Rails for testing.
20
-
21
- h4. Creating a Bug Report
22
-
23
- If you've found a problem in Rails, you can start by "adding a new ticket":http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/new to the Rails Lighthouse. At the minimum, your ticket needs a title and descriptive text. But that's only a minimum. You should include as much relevant information as possible. You need to at least post the code sample that has the issue. Even better is to include a unit test that shows how the expected behavior is not occurring. Your goal should be to make it easy for yourself - and others - to replicate the bug and figure out a fix.
24
-
25
- You shouldn't assign the bug to a particular core developer (through the *Who's Responsible* select list) unless you know for sure which developer will be handling any patch. The core team periodically reviews issues and assigns developers and milestones to them.
26
-
27
- You should set tags for your issue. Use the "bug" tag for a bug report, and add the "patch" tag if you are attaching a patch. Try to find some relevant tags from the existing tag list (which will appear as soon as you start typing in the *Choose some tags* textbox), rather than creating new tags.
28
-
29
- Then don't get your hopes up. Unless you have a "Code Red, Mission Critical, The World is Coming to an End" kind of bug, you're creating this ticket in the hope that others with the same problem will be able to collaborate with you on solving it. Do not expect that the ticket automatically will see any activity or that others will jump to fix it. Creating a ticket like this is mostly to help yourself start on the path of fixing the problem and for others to confirm it with a "I'm having this problem too" comment.
30
-
31
- h4. Special Treatment for Security Issues
32
-
33
- If you've found a security vulnerability in Rails, please do *not* report it via a Lighthouse ticket. Lighthouse tickets are public as soon as they are entered. Instead, you should use the dedicated email address "security@rubyonrails.org":mailto:security@rubyonrails.org to report any vulnerabilities. This alias is monitored and the core team will work with you to quickly and completely address any such vulnerabilities.
34
-
35
- h4. What About Feature Requests?
36
-
37
- Please don't put "feature request" tickets into Lighthouse. If there's a new feature that you want to see added to Rails, you'll need to write the code yourself - or convince someone else to partner with you to write the code. Later in this guide you'll find detailed instructions for proposing a patch to Rails. If you enter a wishlist item in Lighthouse with no code, you can expect it to be marked "invalid" as soon as it's reviewed.
38
-
39
- h3. Running the Rails Test Suite
40
-
41
- To move on from submitting bugs to helping resolve existing issues or contributing your own code to Rails, you _must_ be able to run the Rails test suite. In this section of the guide you'll learn how to set up the tests on your own computer.
42
-
43
- h4. Install git
44
-
45
- Rails uses git for source code control. You won’t be able to do anything without the Rails source code, and this is a prerequisite. The "git homepage":http://git-scm.com/ has installation instructions. If you’re on OS X, use the "Git for OS X":http://code.google.com/p/git-osx-installer/ installer. If you're unfamiliar with git, there are a variety of resources on the net that will help you learn more:
46
-
47
- * "Everyday Git":http://www.kernel.org/pub/software/scm/git/docs/everyday.html will teach you just enough about git to get by.
48
- * The "PeepCode screencast":https://peepcode.com/products/git on git ($9) is easier to follow.
49
- * "GitHub":http://github.com/guides/home offers links to a variety of git resources.
50
-
51
- h4. Get the Rails Source Code
52
-
53
- Don’t fork the main Rails repository. Instead, you want to clone it to your own computer. Navigate to the folder where you want the source code (it will create its own /rails subdirectory) and run:
54
-
55
- <shell>
56
- git clone git://github.com/rails/rails.git
57
- cd rails
58
- </shell>
59
-
60
- h4. Set up and Run the Tests
61
-
62
- All of the Rails tests must pass with any code you submit, otherwise you have no chance of getting code accepted. This means you need to be able to run the tests. For the tests that touch the database, this means creating the databases. If you're using MySQL:
63
-
64
- <shell>
65
- mysql> create database activerecord_unittest;
66
- mysql> create database activerecord_unittest2;
67
- mysql> GRANT ALL PRIVILEGES ON activerecord_unittest.*
68
- to 'rails'@'localhost';
69
- mysql> GRANT ALL PRIVILEGES ON activerecord_unittest2.*
70
- to 'rails'@'localhost';
71
- </shell>
72
-
73
- If you’re using another database, check the files under +activerecord/test/connections+ in the Rails source code for default connection information. You can edit these files if you _must_ on your machine to provide different credentials, but obviously you should not push any such changes back to Rails.
74
-
75
- Now if you go back to the root of the Rails source on your machine and run +rake+ with no parameters, you should see every test in all of the Rails components pass. If you want to run the all ActiveRecord tests (or just a single one) with another database adapter, enter this from the +activerecord+ directory:
76
-
77
- <shell>
78
- rake test_sqlite3
79
- rake test_sqlite3 TEST=test/cases/validations_test.rb
80
- </shell>
81
-
82
- You can change +sqlite3+ with +jdbcmysql+, +jdbcsqlite3+, +jdbcpostgresql+, +mysql+ or +postgresql+. Check out the file +activerecord/RUNNING_UNIT_TESTS+ for information on running more targeted database tests, or the file +ci/ci_build.rb+ to see the test suite that the Rails continuous integration server runs.
83
-
84
-
85
-
86
- NOTE: If you're working with Active Record code, you _must_ ensure that the tests pass for at least MySQL, PostgreSQL, SQLite 2, and SQLite 3. Subtle differences between the various Active Record database adapters have been behind the rejection of many patches that looked OK when tested only against MySQL.
87
-
88
- h3. Helping to Resolve Existing Issues
89
-
90
- As a next step beyond reporting issues, you can help the core team resolve existing issues. If you check the "open tickets":http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets?q=state%3Aopen list in Lighthouse, you'll find hundreds of issues already requiring attention. What can you do for these? Quite a bit, actually:
91
-
92
- h4. Verifying Bug Reports
93
-
94
- For starters, it helps to just verify bug reports. Can you reproduce the reported issue on your own computer? If so, you can add a comment to the ticket saying that you're seeing the same thing.
95
-
96
- If something is very vague, can you help squish it down into something specific? Maybe you can provide additional information to help reproduce a bug, or eliminate needless steps that aren't required to help demonstrate the problem.
97
-
98
- If you find a bug report without a test, it's very useful to contribute a failing test. This is also a great way to get started exploring the Rails source: looking at the existing test files will teach you how to write more tests for Rails. New tests are best contributed in the form of a patch, as explained later on in the "Contributing to the Rails Code" section.
99
-
100
- Anything you can do to make bug reports more succinct or easier to reproduce is a help to folks trying to write code to fix those bugs - whether you end up writing the code yourself or not.
101
-
102
- h4. Testing Patches
103
-
104
- You can also help out by examining patches that have been submitted to Rails via Lighthouse. To apply someone's changes you need to first create a branch of the Rails source code:
105
-
106
- <shell>
107
- git checkout -b testing_branch
108
- </shell>
109
-
110
- Then you can apply their patch:
111
-
112
- <shell>
113
- git am < their-patch-file.diff
114
- </shell>
115
-
116
- After applying a patch, test it out! Here are some things to think about:
117
-
118
- * Does the patch actually work?
119
- * Are you happy with the tests? Can you follow what they're testing? Are there any tests missing?
120
- * Does the documentation still seem right to you?
121
- * Do you like the implementation? Can you think of a nicer or faster way to implement a part of their change?
122
-
123
- Once you're happy that the patch contains a good change, comment on the Lighthouse ticket indicating your approval. Your comment should indicate that you like the change and what you like about it. Something like:
124
-
125
- <blockquote>
126
- I like the way you've restructured that code in generate_finder_sql, much nicer. The tests look good too.
127
- </blockquote>
128
-
129
- If your comment simply says "+1", then odds are that other reviewers aren't going to take it too seriously. Show that you took the time to review the patch. Once three people have approved it, add the "verified" tag. This will bring it to the attention of a core team member who will review the changes looking for the same kinds of things.
130
-
131
- h3. Contributing to the Rails Documentation
132
-
133
- Another area where you can help out if you're not yet ready to take the plunge to writing Rails core code is with Rails documentation. You can help with the Rails Guides or the Rails API documentation.
134
-
135
- TIP: "docrails":http://github.com/lifo/docrails/tree/master is the documentation branch for Rails with an *open commit policy*. You can simply PM "lifo":http://github.com/lifo on Github and ask for the commit rights. Documentation changes made as part of the "docrails":http://github.com/lifo/docrails/tree/master project, are merged back to the Rails master code from time to time. Check out the "original announcement":http://weblog.rubyonrails.org/2008/5/2/help-improve-rails-documentation-on-git-branch for more details.
136
-
137
- h4. The Rails Guides
138
-
139
- The "Rails Guides":http://guides.rubyonrails.org/ are a set of online resources that are designed to make people productive with Rails and to understand how all of the pieces fit together. These guides (including this one!) are written as part of the "docrails":http://github.com/lifo/docrails/tree/master project. If you have an idea for a new guide, or improvements for an existing guide, you can refer to the "contribution page":contribute.html for instructions on getting involved.
140
-
141
- h4. The Rails API Documentation
142
-
143
- The "Rails API documentation":http://api.rubyonrails.org/ is automatically generated from the Rails source code via "RDoc":http://rdoc.rubyforge.org/. If you find some part of the documentation to be incomplete, confusing, or just plain wrong, you can step in and fix it.
144
-
145
- To contribute an update to the API documentation, you can contact "lifo":http://github.com/lifo on GitHub and ask for commit rights to the docrails repository and push your changes to the docrails repository. Please follow the "docrails RDoc conventions":http://wiki.github.com/lifo/docrails/rails-api-documentation-conventions when contributing the changes.
146
-
147
- h3. The Rails Wiki
148
-
149
- The "Rails wiki":http://wiki.rubyonrails.org/ is a collection of user-generated and freely-editable information about Rails. It covers everything from getting started to FAQs to how-tos and popular plugins. To contribute to the wiki, just find some useful information that isn't there already and add it. There are style guidelines to help keep the wiki a coherent resources; see the section on "contributing to the wiki":http://wiki.rubyonrails.org/#contributing_to_the_wiki for more details.
150
-
151
- h3. Contributing to the Rails Code
152
-
153
- When you're ready to take the plunge, one of the most helpful ways to contribute to Rails is to actually submit source code. Here's a step-by-step listing of the things you need to do to make this a successful experience.
154
-
155
- h4. Learn the Language and the Framework
156
-
157
- Learn at least _something_ about Ruby and Rails. If you don’t understand the syntax of the language, common Ruby idioms, and the code that already exists in Rails, you’re unlikely to be able to build a good patch (that is, one that will get accepted). You don’t have to know every in-and-out of the language and the framework; some of the Rails code is fiendishly complex. But Rails is probably not appropriate as the first place that you ever write Ruby code. You should at least understand (though not necessarily memorize) "The Ruby Programming Language":http://www.amazon.com/gp/product/0596516177?ie=UTF8&linkCode=as2&camp=1789&creative=390957&creativeASIN=0596516177 and have browsed the Rails source code.
158
-
159
- h4. Fork the Rails Source Code
160
-
161
- Fork Rails. You’re not going to put your patches right into the master branch, OK? This is where you need that copy of Rails that you cloned earlier. Think of a name for your new branch and run
162
-
163
- <shell>
164
- git checkout -b my_new_branch
165
- </shell>
166
-
167
- It doesn’t really matter what name you use, because this branch will only exist on your local computer.
168
-
169
- h4. Write Your Code
170
-
171
- Now get busy and add your code to Rails (or edit the existing code). You’re on your branch now, so you can write whatever you want (you can check to make sure you’re on the right branch with +git branch -a+). But if you’re planning to submit your change back for inclusion in Rails, keep a few things in mind:
172
-
173
- * Get the code right
174
- * Use Rails idioms and helpers
175
- * Include tests that fail without your code, and pass with it
176
- * Update the documentation
177
-
178
- h4. Sanity Check
179
-
180
- You should not be the only person who looks at the code before you submit it. You know at least one other Rails developer, right? Show them what you’re doing and ask for feedback. Doing this in private before you push a patch out publicly is the “smoke test” for a patch: if you can’t convince one other developer of the beauty of your code, you’re unlikely to convince the core team either.
181
-
182
- h4. Commit Your Changes
183
-
184
- When you're happy with the code on your computer, you need to commit the changes to git:
185
-
186
- <shell>
187
- git commit -a -m "Here is a commit message"
188
- </shell>
189
-
190
- h4. Update Rails
191
-
192
- Update your copy of Rails. It’s pretty likely that other changes to core Rails have happened while you were working. Go get them:
193
-
194
- <shell>
195
- git checkout master
196
- git pull
197
- </shell>
198
-
199
- Now reapply your patch on top of the latest changes:
200
-
201
- <shell>
202
- git checkout my_new_branch
203
- git rebase master
204
- </shell>
205
-
206
- No conflicts? Tests still pass? Change still seems reasonable to you? Then move on.
207
-
208
- h4. Create a Patch
209
-
210
- Now you can create a patch file to share with other developers (and with the Rails core team). Still in your branch, run
211
-
212
- <shell>
213
- git commit -a
214
- git format-patch master --stdout > my_new_patch.diff
215
- </shell>
216
-
217
- Sanity check the results of this operation: open the diff file in your text editor of choice and make sure that no unintended changes crept in.
218
-
219
- h4. Create a Lighthouse Ticket
220
-
221
- Now create a ticket with your patch. Go to the "new ticket":http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/new page at Lighthouse. Fill in a reasonable title and description, remember to attach your patch file, and tag the ticket with the ‘patch’ tag and whatever other subject area tags make sense.
222
-
223
- h4. Get Some Feedback
224
-
225
- Now you need to get other people to look at your patch, just as you've looked at other people's patches. You can use the rubyonrails-core mailing list or the #rails-contrib channel on IRC freenode for this. You might also try just talking to Rails developers that you know.
226
-
227
- h4. Iterate as Necessary
228
-
229
- It’s entirely possible that the feedback you get will suggest changes. Don’t get discouraged: the whole point of contributing to an active open source project is to tap into community knowledge. If people are encouraging you to tweak your code, then it’s worth making the tweaks and resubmitting. If the feedback is that your code doesn’t belong in the core, you might still think about releasing it as a plugin.
230
-
231
- And then...think about your next contribution!
232
-
233
- h3. Changelog
234
-
235
- "Lighthouse ticket":http://rails.lighthouseapp.com/projects/16213-rails-guides/tickets/64
236
-
237
- * March 2, 2009: Initial draft by "Mike Gunderloy":credits.html#mgunderloy
238
-
239
-