diff options
author | Mike Gunderloy <MikeG1@larkfarm.com> | 2008-11-18 11:05:04 -0600 |
---|---|---|
committer | Mike Gunderloy <MikeG1@larkfarm.com> | 2008-11-18 11:05:04 -0600 |
commit | 64e8f14058949b0b1967a4d1282c6fc154e890e9 (patch) | |
tree | 2500513099eb3ec9ef495377a4970c46b7defb63 /railties/doc/guides | |
parent | b930d2f259f7ebf3c7134db82dde02c55e00070c (diff) | |
download | rails-64e8f14058949b0b1967a4d1282c6fc154e890e9.tar.gz rails-64e8f14058949b0b1967a4d1282c6fc154e890e9.tar.bz2 rails-64e8f14058949b0b1967a4d1282c6fc154e890e9.zip |
Configuration options for Active Model, Active Resource, Active Support
Diffstat (limited to 'railties/doc/guides')
-rw-r--r-- | railties/doc/guides/html/configuring.html | 181 | ||||
-rw-r--r-- | railties/doc/guides/source/configuring.txt | 174 |
2 files changed, 114 insertions, 241 deletions
diff --git a/railties/doc/guides/html/configuring.html b/railties/doc/guides/html/configuring.html index 55f5d48554..adc827c89a 100644 --- a/railties/doc/guides/html/configuring.html +++ b/railties/doc/guides/html/configuring.html @@ -223,6 +223,8 @@ ul#navMain { <li><a href="#_configuring_active_support">Configuring Active Support</a></li> + <li><a href="#_configuring_active_model">Configuring Active Model</a></li> + </ul> </li> <li> @@ -332,11 +334,78 @@ after-initializer</p></div> <div class="para"><p></p></div>
<div class="para"><p><tt>default_form_builder</tt> tells Rails which form builder to use by default. The default is <tt>ActionView::Helpers::FormBuilder</tt>.</p></div>
<div class="para"><p>The ERB template handler supplies one additional option:</p></div>
-<div class="para"><p><tt>ActionView::TemplateHandlers::ERB.erb_trim_mode</tt> gives the trim mode to be used by ERB. It defaults to <tt><em>-</em></tt>.</p></div>
+<div class="para"><p><tt>ActionView::TemplateHandlers::ERB.erb_trim_mode</tt> gives the trim mode to be used by ERB. It defaults to <tt><em>-</em></tt>. See the <a href="http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/">ERB documentation</a> for more information.</p></div>
<h3 id="_configuring_action_mailer">4.4. Configuring Action Mailer</h3>
<div class="para"><p>There are a number of settings available on <tt>ActionMailer::Base</tt>:</p></div>
+<div class="para"><p><tt>template_root</tt> gives the root folder for Action Mailer templates.</p></div>
+<div class="para"><p><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 Action Mailer. Set to nil to disable logging.</p></div>
+<div class="para"><p><tt>smtp_settings</tt> allows detailed configuration for the <tt>:smtp</tt> delivery method. It accepts a hash of options, which can include any of these options:</p></div>
+<div class="ilist"><ul>
+<li>
+<p>
+<tt>:address</tt> - Allows you to use a remote mail server. Just change it from its default "localhost" setting.
+</p>
+</li>
+<li>
+<p>
+<tt>:port</tt> - On the off chance that your mail server doesn't run on port 25, you can change it.
+</p>
+</li>
+<li>
+<p>
+<tt>:domain</tt> - If you need to specify a HELO domain, you can do it here.
+</p>
+</li>
+<li>
+<p>
+<tt>:user_name</tt> - If your mail server requires authentication, set the username in this setting.
+</p>
+</li>
+<li>
+<p>
+<tt>:password</tt> - If your mail server requires authentication, set the password in this setting.
+</p>
+</li>
+<li>
+<p>
+<tt>:authentication</tt> - If your mail server requires authentication, you need to specify the authentication type here. This is a symbol and one of <tt>:plain</tt>, <tt>:login</tt>, <tt>:cram_md5</tt>.
+</p>
+</li>
+</ul></div>
+<div class="para"><p><tt>sendmail_settings</tt> allows detailed configuration for the <tt>sendmail</tt> delivery method. It accepts a hash of options, which can include any of these options:</p></div>
+<div class="ilist"><ul>
+<li>
+<p>
+<tt>:location</tt> - The location of the sendmail executable. Defaults to <tt>/usr/sbin/sendmail</tt>.
+</p>
+</li>
+<li>
+<p>
+<tt>:arguments</tt> - The command line arguments. Defaults to <tt>-i -t</tt>.
+</p>
+</li>
+</ul></div>
+<div class="para"><p><tt>raise_delivery_errors</tt> specifies whether to raise an error if email delivery cannot be completed. It defaults to <tt>true</tt>.</p></div>
+<div class="para"><p><tt>delivery_method</tt> defines the delivery method. The allowed values are <tt>:smtp</tt> (default), <tt>:sendmail</tt>, and <tt>:test</tt>.</p></div>
+<div class="para"><p><tt>perform_deliveries</tt> specifies whether mail will actually be delivered. By default this is <tt>true</tt>; it can be convenient to set it to <tt>false</tt> for testing.</p></div>
+<div class="para"><p><tt>default_charset</tt> tells Action Mailer which character set to use for the body and for encoding the subject. It defaults to <tt>utf-8</tt>.</p></div>
+<div class="para"><p><tt>default_content_type</tt> specifies the default content type used for the main part of the message. It defaults to "text/plain"</p></div>
+<div class="para"><p><tt>default_mime_version</tt> is the default MIME version for the message. It defaults to <tt>1.0</tt>.</p></div>
+<div class="para"><p><tt>default_implicit_parts_order</tt> - When a message is built implicitly (i.e. multiple parts are assembled from templates
+which specify the content type in their filenames) this variable controls how the parts are ordered. Defaults to
+<tt>["text/html", "text/enriched", "text/plain"]</tt>. Items that appear first in the array have higher priority in the mail client
+and appear last in the mime encoded message.</p></div>
<h3 id="_configuring_active_resource">4.5. Configuring Active Resource</h3>
+<div class="para"><p>There is a single configuration setting available on <tt>ActiveResource::Base</tt>:</p></div>
+<div class="para"><p><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.</p></div>
<h3 id="_configuring_active_support">4.6. Configuring Active Support</h3>
+<div class="para"><p>There are a few configuration options available in Active Support:</p></div>
+<div class="para"><p><tt>ActiveSupport::BufferedLogger.silencer</tt> is set to <tt>false</tt> to disable the ability to silence logging in a block. The default is <tt>true</tt>.</p></div>
+<div class="para"><p><tt>ActiveSupport::Cache::Store.logger</tt> specifies the logger to use within cache store operations.</p></div>
+<div class="para"><p><tt>ActiveSupport::Logger.silencer</tt> is set to <tt>false</tt> to disable the ability to silence logging in a block. The default is <tt>true</tt>.</p></div>
+<h3 id="_configuring_active_model">4.7. Configuring Active Model</h3>
+<div class="para"><p>Active Model currently has a single configuration setting:</p></div>
+<div class="para"><p>+ActiveModel::Errors.default_error_messages is an array containing all of the validation error messages.</p></div>
</div>
<h2 id="_using_initializers">5. Using Initializers</h2>
<div class="sectionbody">
@@ -360,114 +429,6 @@ after-initializer</p></div> <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 << <em>—line-numbers</em> << <em>—inline-source</em> << <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 ⇒ 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 << <em>—line-numbers</em> << <em>—inline-source</em> << <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 ⇒ false
-11: base.cattr_accessor :time_zone_aware_attributes, :instance_writer ⇒ false</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 << <em>—line-numbers</em> << <em>—inline-source</em> << <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 ⇒ false</p></div>
-<div class="para"><p>activesupport/test/core_ext/module/synchronization_test.rb
-6: @target.cattr_accessor :mutex, :instance_writer ⇒ false</p></div>
-<div class="para"><p>railties/doc/guides/html/creating_plugins.html
-786: cattr_accessor <span style="color: #990000">:</span>yaffle_text_field<span style="color: #990000">,</span> <span style="color: #990000">:</span>yaffle_date_field
-860: cattr_accessor <span style="color: #990000">:</span>yaffle_text_field<span style="color: #990000">,</span> <span style="color: #990000">:</span>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 << <em>—line-numbers</em> << <em>—inline-source</em> << <em>—accessor</em> << <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 << <em>-A cattr_accessor=object</em></p></div>
<div class="qlist"><ol>
<li>
<p><em>
@@ -475,6 +436,8 @@ need to look for def self. ? </em></p>
</li>
</ol></div>
+</li>
+</ul></div>
</div>
</div> diff --git a/railties/doc/guides/source/configuring.txt b/railties/doc/guides/source/configuring.txt index 1fb73abbb8..945e48cd45 100644 --- a/railties/doc/guides/source/configuring.txt +++ b/railties/doc/guides/source/configuring.txt @@ -113,172 +113,82 @@ There are only a few configuration options for Action View, starting with four o The ERB template handler supplies one additional option: -+ActionView::TemplateHandlers::ERB.erb_trim_mode+ gives the trim mode to be used by ERB. It defaults to +'-'+. ++ActionView::TemplateHandlers::ERB.erb_trim_mode+ gives the trim mode to be used by ERB. It defaults to +'-'+. See the link:http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/[ERB documentation] for more information. === Configuring Action Mailer There are a number of settings available on +ActionMailer::Base+: ++template_root+ gives the root folder for Action Mailer templates. ++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. -=== Configuring Active Resource - -=== Configuring Active Support - -== Using Initializers - organization, controlling load order - -== Using an After-Initializer ++smtp_settings+ allows detailed configuration for the +:smtp+ delivery method. It accepts a hash of options, which can include any of these options: -== Rails Environment Settings - -ENV - -== Changelog == - -http://rails.lighthouseapp.com/projects/16213-rails-guides/tickets/28[Lighthouse ticket] +* <tt>:address</tt> - Allows you to use a remote mail server. Just change it from its default "localhost" setting. +* <tt>:port</tt> - On the off chance that your mail server doesn't run on port 25, you can change it. +* <tt>:domain</tt> - If you need to specify a HELO domain, you can do it here. +* <tt>:user_name</tt> - If your mail server requires authentication, set the username in this setting. +* <tt>:password</tt> - If your mail server requires authentication, set the password in this setting. +* <tt>:authentication</tt> - If your mail server requires authentication, you need to specify the authentication type here. This is a symbol and one of <tt>:plain</tt>, <tt>:login</tt>, <tt>:cram_md5</tt>. -* November 5, 2008: Rough outline by link:../authors.html#mgunderloy[Mike Gunderloy] ++sendmail_settings+ allows detailed configuration for the +sendmail+ delivery method. It accepts a hash of options, which can include any of these options: +* <tt>:location</tt> - The location of the sendmail executable. Defaults to <tt>/usr/sbin/sendmail</tt>. +* <tt>:arguments</tt> - The command line arguments. Defaults to <tt>-i -t</tt>. -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 - -actionmailer/Rakefile -36: rdoc.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object' - -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 ++raise_delivery_errors+ specifies whether to raise an error if email delivery cannot be completed. It defaults to +true+. -actionpack/lib/action_controller/caching/pages.rb -55: cattr_accessor :page_cache_directory -58: cattr_accessor :page_cache_extension ++delivery_method+ defines the delivery method. The allowed values are <tt>:smtp</tt> (default), <tt>:sendmail</tt>, and <tt>:test</tt>. -actionpack/lib/action_controller/caching.rb -37: cattr_reader :cache_store -48: cattr_accessor :perform_caching ++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. -actionpack/lib/action_controller/dispatcher.rb -98: cattr_accessor :error_file_path ++default_charset+ tells Action Mailer which character set to use for the body and for encoding the subject. It defaults to +utf-8+. -actionpack/lib/action_controller/mime_type.rb -24: cattr_reader :html_types, :unverifiable_types ++default_content_type+ specifies the default content type used for the main part of the message. It defaults to "text/plain" -actionpack/lib/action_controller/rescue.rb -36: base.cattr_accessor :rescue_responses -40: base.cattr_accessor :rescue_templates ++default_mime_version+ is the default MIME version for the message. It defaults to +1.0+. -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 ++default_implicit_parts_order+ - When a message is built implicitly (i.e. multiple parts are assembled from templates +which specify the content type in their filenames) this variable controls how the parts are ordered. Defaults to +<tt>["text/html", "text/enriched", "text/plain"]</tt>. Items that appear first in the array have higher priority in the mail client +and appear last in the mime encoded message. -actionpack/lib/action_controller/vendor/html-scanner/html/sanitizer.rb -44: cattr_accessor :included_tags, :instance_writer => false - -actionpack/lib/action_view/base.rb -189: cattr_accessor :debug_rjs -193: cattr_accessor :warn_cache_misses - -actionpack/lib/action_view/helpers/active_record_helper.rb -7: cattr_accessor :field_error_proc - -actionpack/lib/action_view/helpers/form_helper.rb -805: cattr_accessor :default_form_builder - -actionpack/lib/action_view/template_handlers/erb.rb -47: cattr_accessor :erb_trim_mode - -actionpack/test/active_record_unit.rb -5: cattr_accessor :able_to_connect -6: cattr_accessor :connected +=== Configuring Active Resource -actionpack/test/controller/filters_test.rb -286: cattr_accessor :execution_log +There is a single configuration setting available on +ActiveResource::Base+: -actionpack/test/template/form_options_helper_test.rb -3:TZInfo::Timezone.cattr_reader :loaded_zones ++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 Active Resource. Set to nil to disable logging. -activemodel/lib/active_model/errors.rb -28: cattr_accessor :default_error_messages +=== Configuring Active Support -activemodel/Rakefile -19: rdoc.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object' +There are a few configuration options available in Active Support: -activerecord/lib/active_record/attribute_methods.rb -9: base.cattr_accessor :attribute_types_cached_by_default, :instance_writer => false -11: base.cattr_accessor :time_zone_aware_attributes, :instance_writer => false ++ActiveSupport::BufferedLogger.silencer+ is set to +false+ to disable the ability to silence logging in a block. The default is +true+. ++ActiveSupport::Cache::Store.logger+ specifies the logger to use within cache store operations. -activeresource/lib/active_resource/base.rb -206: cattr_accessor :logger ++ActiveSupport::Logger.silencer+ is set to +false+ to disable the ability to silence logging in a block. The default is +true+. -activeresource/Rakefile -43: rdoc.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object' - -activesupport/lib/active_support/buffered_logger.rb -17: cattr_accessor :silencer - -activesupport/lib/active_support/cache.rb -81: cattr_accessor :logger +=== Configuring Active Model -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) +Active Model currently has a single configuration setting: -activesupport/lib/active_support/core_ext/logger.rb -34: cattr_accessor :silencer ++ActiveModel::Errors.default_error_messages is an array containing all of the validation error messages. -activesupport/test/core_ext/class/attribute_accessor_test.rb -6: cattr_accessor :foo -7: cattr_accessor :bar, :instance_writer => false +== Using Initializers + organization, controlling load order -activesupport/test/core_ext/module/synchronization_test.rb -6: @target.cattr_accessor :mutex, :instance_writer => false +== Using an After-Initializer -railties/doc/guides/html/creating_plugins.html -786: cattr_accessor <span style="color: #990000">:</span>yaffle_text_field<span style="color: #990000">,</span> <span style="color: #990000">:</span>yaffle_date_field -860: cattr_accessor <span style="color: #990000">:</span>yaffle_text_field<span style="color: #990000">,</span> <span style="color: #990000">:</span>yaffle_date_field +== Rails Environment Settings -railties/lib/rails_generator/base.rb -93: cattr_accessor :logger +ENV -railties/Rakefile -265: rdoc.options << '--line-numbers' << '--inline-source' << '--accessor' << 'cattr_accessor=object' +== Changelog == -railties/test/rails_info_controller_test.rb -12: cattr_accessor :local_request +http://rails.lighthouseapp.com/projects/16213-rails-guides/tickets/28[Lighthouse ticket] -Rakefile -32: rdoc.options << '-A cattr_accessor=object' +* November 5, 2008: Rough outline by link:../authors.html#mgunderloy[Mike Gunderloy] need to look for def self. ??? |