Source

RubyLearning / ProjectTrak / vendor / rails / railties / doc / guides / html / configuring.html

Full commit
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>Configuring Rails Applications</title>
	<!--[if lt IE 8]>
	<script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE8.js" type="text/javascript"></script>
	<![endif]-->
	<link href="stylesheets/base.css" media="screen" rel="Stylesheet" type="text/css" />
	<link href="stylesheets/forms.css" media="screen" rel="Stylesheet" type="text/css" />
	<link href="stylesheets/more.css" media="screen" rel="Stylesheet" type="text/css" />
	<style type="text/css">
		div#container {
	max-width: 900px;
	padding-bottom: 3em;
}

div#content {
	margin-left: 200px;
}

div#container.notoc {
	max-width: 600px;
}

.notoc div#content {
	margin-left: 0;
}

pre {
	line-height: 1.4em;
}

#content p tt {
	background: #eeeeee;
	border: solid 1px #cccccc;
	padding: 3px;
}

dt {
	font-weight: bold;
}

#content dt tt {
	font-size: 10pt;
}

dd {
	margin-left: 3em;
}

#content dt tt, #content pre tt {
	background: none;
	padding: 0;
	border: 0;
}

#content .olist ol {
	margin-left: 2em;
}

#header {
	position: relative;
	max-width: 840px;
	margin-left: auto;
	margin-right: auto;
}

#header.notoc {
	max-width: 580px;
}

#logo {
	position: absolute;
	left: 10px;
	top: 10px;
	width: 110px;
	height: 140px;
}

div#header h1#site_title {
	background: url('images/ruby_on_rails_by_mike_rundle2.gif') top left no-repeat;
	position: absolute;
	width: 392px;
	height: 55px;
	left: 145px;
	top: 20px;
	margin: 0;
	padding: 0;
}

#site_title span {
	display: none;
}

#site_title_tagline {
	display: none;
}

ul#navMain {
	position: absolute;
	margin: 0;
	padding: 0;
	top: 97px;
	left: 145px;
}

.left-floaty, .right-floaty {
	padding: 15px;
}

.admonitionblock,
.tableblock {
	margin-left: 1em;
	margin-right: 1em;
	margin-top: 0.25em;
	margin-bottom: 1em;
}

.admonitionblock .icon {
	padding-right: 8px;
}

.admonitionblock .content {
	border: solid 1px #ffda78;
	background: #fffebd;
	padding: 10px;
	padding-top: 8px;
	padding-bottom: 8px;
}

.admonitionblock .title {
	font-size: 140%;
	margin-bottom: 0.5em;
}

.tableblock table {
	border: solid 1px #aaaaff;
	background: #f0f0ff;
}

.tableblock th {
	background: #e0e0e0;
}

.tableblock th,
.tableblock td {
	padding: 3px;
	padding-left: 5px;
	padding-right: 5px;
}

.sidebarblock {
	margin-top: 0.25em;
	margin: 1em;
	border: solid 1px #ccccbb;
	padding: 8px;
	background: #ffffe0;
}

.sidebarblock .sidebar-title {
	font-size: 140%;
	font-weight: 600;
	margin-bottom: 0.3em;
}

.sidebarblock .sidebar-content > .para:last-child > p {
	margin-bottom: 0;
}

.sidebarblock .sidebar-title a {
	text-decoration: none;
}

.sidebarblock .sidebar-title a:hover {
	text-decoration: underline;
}

	</style>
</head>
<body>
	<div id="header" >
		<div id="logo">
			<a href="index.html" title="Ruby on Rails"><img src="images/rails_logo_remix.gif" alt="Rails" height="140" width="110" /></a>
		</div>
		
		<h1 id="site_title"><span>Ruby on Rails</span></h1>
		<h2 id="site_title_tagline">Sustainable productivity for web-application development</h2>

		<ul id="navMain">
			<li class="first-child"><a href="http://www.rubyonrails.org/" title="Ruby on Rails" class="ruby_on_rails">Ruby on Rails</a></li>
			<li><a class="manuals" href="index.html" title="Manuals Index">Guides Index</a></li>
		</ul>
	</div>

	<div id="container">
		
		<div id="sidebar">
			<h2>Chapters</h2>
			<ol>
					<li>
					<a href="#_locations_for_initialization_code">Locations for Initialization Code</a>
					</li>
					<li>
					<a href="#_using_a_preinitializer">Using a Preinitializer</a>
					</li>
					<li>
					<a href="#_configuring_rails_components">Configuring Rails Components</a>
						<ul>
						
							<li><a href="#_configuring_active_record">Configuring Active Record</a></li>
						
							<li><a href="#_configuring_action_controller">Configuring Action Controller</a></li>
						
							<li><a href="#_configuring_action_view">Configuring Action View</a></li>
						
							<li><a href="#_configuring_action_mailer">Configuring Action Mailer</a></li>
						
							<li><a href="#_configuring_active_resource">Configuring Active Resource</a></li>
						
							<li><a href="#_configuring_active_support">Configuring Active Support</a></li>
						
						</ul>
					</li>
					<li>
					<a href="#_using_initializers">Using Initializers</a>
					</li>
					<li>
					<a href="#_using_an_after_initializer">Using an After-Initializer</a>
					</li>
					<li>
					<a href="#_changelog">Changelog</a>
					</li>
			</ol>
		</div>
		
		<div id="content">
				<h1>Configuring Rails Applications</h1>
			<div id="preamble">
<div class="sectionbody">
<div class="para"><p>This guide covers the configuration and initialization features available to Rails applications. By referring to this guide, you will be able to:</p></div>
<div class="ilist"><ul>
<li>
<p>
Adjust the behavior of your Rails applications
</p>
</li>
<li>
<p>
Add additional code to be run at application start time
</p>
</li>
</ul></div>
</div>
</div>
<h2 id="_locations_for_initialization_code">1. Locations for Initialization Code</h2>
<div class="sectionbody">
<div class="para"><p>preinitializers
environment.rb first
env-specific files
initializers (load_application_initializers)
after-initializer</p></div>
</div>
<h2 id="_using_a_preinitializer">2. Using a Preinitializer</h2>
<div class="sectionbody">
</div>
<h2 id="_configuring_rails_components">3. Configuring Rails Components</h2>
<div class="sectionbody">
<h3 id="_configuring_active_record">3.1. Configuring Active Record</h3>
<h3 id="_configuring_action_controller">3.2. Configuring Action Controller</h3>
<h3 id="_configuring_action_view">3.3. Configuring Action View</h3>
<h3 id="_configuring_action_mailer">3.4. Configuring Action Mailer</h3>
<h3 id="_configuring_active_resource">3.5. Configuring Active Resource</h3>
<h3 id="_configuring_active_support">3.6. Configuring Active Support</h3>
</div>
<h2 id="_using_initializers">4. Using Initializers</h2>
<div class="sectionbody">
<div class="literalblock">
<div class="content">
<pre><tt>organization, controlling load order</tt></pre>
</div></div>
</div>
<h2 id="_using_an_after_initializer">5. Using an After-Initializer</h2>
<div class="sectionbody">
</div>
<h2 id="_changelog">6. Changelog</h2>
<div class="sectionbody">
<div class="para"><p><a href="http://rails.lighthouseapp.com/projects/16213-rails-guides/tickets/28">Lighthouse ticket</a></p></div>
<div class="ilist"><ul>
<li>
<p>
November 5, 2008: Rough outline by <a href="../authors.html#mgunderloy">Mike Gunderloy</a>
</p>
</li>
</ul></div>
<div class="para"><p>actionmailer/lib/action_mailer/base.rb
257:    cattr_accessor :logger
267:    cattr_accessor :smtp_settings
273:    cattr_accessor :sendmail_settings
276:    cattr_accessor :raise_delivery_errors
282:    cattr_accessor :perform_deliveries
285:    cattr_accessor :deliveries
288:    cattr_accessor :default_charset
291:    cattr_accessor :default_content_type
294:    cattr_accessor :default_mime_version
297:    cattr_accessor :default_implicit_parts_order
299:    cattr_reader :protected_instance_variables</p></div>
<div class="para"><p>actionmailer/Rakefile
36:  rdoc.options &lt;&lt; <em>&#8212;line-numbers</em> &lt;&lt; <em>&#8212;inline-source</em> &lt;&lt; <em>-A cattr_accessor=object</em></p></div>
<div class="para"><p>actionpack/lib/action_controller/base.rb
263:    cattr_reader :protected_instance_variables
273:    cattr_accessor :asset_host
279:    cattr_accessor :consider_all_requests_local
285:    cattr_accessor :allow_concurrency
317:    cattr_accessor :param_parsers
321:    cattr_accessor :default_charset
325:    cattr_accessor :logger
329:    cattr_accessor :resource_action_separator
333:    cattr_accessor :resources_path_names
337:    cattr_accessor :request_forgery_protection_token
341:    cattr_accessor :optimise_named_routes
351:    cattr_accessor :use_accept_header
361:    cattr_accessor :relative_url_root</p></div>
<div class="para"><p>actionpack/lib/action_controller/caching/pages.rb
55:          cattr_accessor :page_cache_directory
58:          cattr_accessor :page_cache_extension</p></div>
<div class="para"><p>actionpack/lib/action_controller/caching.rb
37:        cattr_reader :cache_store
48:        cattr_accessor :perform_caching</p></div>
<div class="para"><p>actionpack/lib/action_controller/dispatcher.rb
98:    cattr_accessor :error_file_path</p></div>
<div class="para"><p>actionpack/lib/action_controller/mime_type.rb
24:    cattr_reader :html_types, :unverifiable_types</p></div>
<div class="para"><p>actionpack/lib/action_controller/rescue.rb
36:      base.cattr_accessor :rescue_responses
40:      base.cattr_accessor :rescue_templates</p></div>
<div class="para"><p>actionpack/lib/action_controller/session/active_record_store.rb
60:        cattr_accessor :data_column_name
170:        cattr_accessor :connection
173:        cattr_accessor :table_name
177:        cattr_accessor :session_id_column
181:        cattr_accessor :data_column
282:      cattr_accessor :session_class</p></div>
<div class="para"><p>actionpack/lib/action_controller/vendor/html-scanner/html/sanitizer.rb
44:    cattr_accessor :included_tags, :instance_writer &#8658; false</p></div>
<div class="para"><p>actionpack/lib/action_view/base.rb
189:    cattr_accessor :debug_rjs
193:    cattr_accessor :warn_cache_misses</p></div>
<div class="para"><p>actionpack/lib/action_view/helpers/active_record_helper.rb
7:    cattr_accessor :field_error_proc</p></div>
<div class="para"><p>actionpack/lib/action_view/helpers/form_helper.rb
805:    cattr_accessor :default_form_builder</p></div>
<div class="para"><p>actionpack/lib/action_view/template_handlers/erb.rb
47:      cattr_accessor :erb_trim_mode</p></div>
<div class="para"><p>actionpack/test/active_record_unit.rb
5:  cattr_accessor :able_to_connect
6:  cattr_accessor :connected</p></div>
<div class="para"><p>actionpack/test/controller/filters_test.rb
286:    cattr_accessor :execution_log</p></div>
<div class="para"><p>actionpack/test/template/form_options_helper_test.rb
3:TZInfo::Timezone.cattr_reader :loaded_zones</p></div>
<div class="para"><p>activemodel/lib/active_model/errors.rb
28:    cattr_accessor :default_error_messages</p></div>
<div class="para"><p>activemodel/Rakefile
19:  rdoc.options &lt;&lt; <em>&#8212;line-numbers</em> &lt;&lt; <em>&#8212;inline-source</em> &lt;&lt; <em>-A cattr_accessor=object</em></p></div>
<div class="para"><p>activerecord/lib/active_record/attribute_methods.rb
9:      base.cattr_accessor :attribute_types_cached_by_default, :instance_writer &#8658; false
11:      base.cattr_accessor :time_zone_aware_attributes, :instance_writer &#8658; false</p></div>
<div class="para"><p>activerecord/lib/active_record/base.rb
394:    cattr_accessor :logger, :instance_writer &#8658; false
443:    cattr_accessor :configurations, :instance_writer &#8658; false
450:    cattr_accessor :primary_key_prefix_type, :instance_writer &#8658; false
456:    cattr_accessor :table_name_prefix, :instance_writer &#8658; false
461:    cattr_accessor :table_name_suffix, :instance_writer &#8658; false
467:    cattr_accessor :pluralize_table_names, :instance_writer &#8658; false
473:    cattr_accessor :colorize_logging, :instance_writer &#8658; false
478:    cattr_accessor :default_timezone, :instance_writer &#8658; false
487:    cattr_accessor :schema_format , :instance_writer &#8658; false
491:    cattr_accessor :timestamped_migrations , :instance_writer &#8658; false</p></div>
<div class="para"><p>activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb
11:    cattr_accessor :connection_handler, :instance_writer &#8658; false</p></div>
<div class="para"><p>activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
166:      cattr_accessor :emulate_booleans</p></div>
<div class="para"><p>activerecord/lib/active_record/fixtures.rb
498:  cattr_accessor :all_loaded_fixtures</p></div>
<div class="para"><p>activerecord/lib/active_record/locking/optimistic.rb
38:        base.cattr_accessor :lock_optimistically, :instance_writer &#8658; false</p></div>
<div class="para"><p>activerecord/lib/active_record/migration.rb
259:    cattr_accessor :verbose</p></div>
<div class="para"><p>activerecord/lib/active_record/schema_dumper.rb
13:    cattr_accessor :ignore_tables</p></div>
<div class="para"><p>activerecord/lib/active_record/serializers/json_serializer.rb
4:      base.cattr_accessor :include_root_in_json, :instance_writer &#8658; false</p></div>
<div class="para"><p>activerecord/Rakefile
142:  rdoc.options &lt;&lt; <em>&#8212;line-numbers</em> &lt;&lt; <em>&#8212;inline-source</em> &lt;&lt; <em>-A cattr_accessor=object</em></p></div>
<div class="para"><p>activerecord/test/cases/lifecycle_test.rb
61:  cattr_reader :last_inherited</p></div>
<div class="para"><p>activerecord/test/cases/mixin_test.rb
9:  cattr_accessor :forced_now_time</p></div>
<div class="para"><p>activeresource/lib/active_resource/base.rb
206:    cattr_accessor :logger</p></div>
<div class="para"><p>activeresource/Rakefile
43:  rdoc.options &lt;&lt; <em>&#8212;line-numbers</em> &lt;&lt; <em>&#8212;inline-source</em> &lt;&lt; <em>-A cattr_accessor=object</em></p></div>
<div class="para"><p>activesupport/lib/active_support/buffered_logger.rb
17:    cattr_accessor :silencer</p></div>
<div class="para"><p>activesupport/lib/active_support/cache.rb
81:      cattr_accessor :logger</p></div>
<div class="para"><p>activesupport/lib/active_support/core_ext/class/attribute_accessors.rb
5:#    cattr_accessor :hair_colors
10:  def cattr_reader(*syms)
29:  def cattr_writer(*syms)
50:  def cattr_accessor(*syms)
51:    cattr_reader(*syms)
52:    cattr_writer(*syms)</p></div>
<div class="para"><p>activesupport/lib/active_support/core_ext/logger.rb
34:  cattr_accessor :silencer</p></div>
<div class="para"><p>activesupport/test/core_ext/class/attribute_accessor_test.rb
6:      cattr_accessor :foo
7:      cattr_accessor :bar, :instance_writer &#8658; false</p></div>
<div class="para"><p>activesupport/test/core_ext/module/synchronization_test.rb
6:    @target.cattr_accessor :mutex, :instance_writer &#8658; false</p></div>
<div class="para"><p>railties/doc/guides/html/creating_plugins.html
786:      cattr_accessor &lt;span style="color: #990000"&gt;:&lt;/span&gt;yaffle_text_field&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #990000"&gt;:&lt;/span&gt;yaffle_date_field
860:      cattr_accessor &lt;span style="color: #990000"&gt;:&lt;/span&gt;yaffle_text_field&lt;span style="color: #990000"&gt;,&lt;/span&gt; &lt;span style="color: #990000"&gt;:&lt;/span&gt;yaffle_date_field</p></div>
<div class="para"><p>railties/lib/rails_generator/base.rb
93:      cattr_accessor :logger</p></div>
<div class="para"><p>railties/Rakefile
265:  rdoc.options &lt;&lt; <em>&#8212;line-numbers</em> &lt;&lt; <em>&#8212;inline-source</em> &lt;&lt; <em>&#8212;accessor</em> &lt;&lt; <em>cattr_accessor=object</em></p></div>
<div class="para"><p>railties/test/rails_info_controller_test.rb
12:    cattr_accessor :local_request</p></div>
<div class="para"><p>Rakefile
32:  rdoc.options &lt;&lt; <em>-A cattr_accessor=object</em></p></div>
</div>

		</div>
	</div>
</body>
</html>