diff options
author | Mike Gunderloy <MikeG1@larkfarm.com> | 2008-11-15 10:48:16 -0600 |
---|---|---|
committer | Mike Gunderloy <MikeG1@larkfarm.com> | 2008-11-15 10:48:16 -0600 |
commit | 1d910aac0a90fc881224f90b1a380ffa5435eb9d (patch) | |
tree | 24d5d33c4e9a236a8bf1df5a15ccec54f64ce617 /railties | |
parent | 46afe7cfff880fb82b50193a1c87430b51488735 (diff) | |
download | rails-1d910aac0a90fc881224f90b1a380ffa5435eb9d.tar.gz rails-1d910aac0a90fc881224f90b1a380ffa5435eb9d.tar.bz2 rails-1d910aac0a90fc881224f90b1a380ffa5435eb9d.zip |
Added documentation of ActiveRecord configuration options to Configuration Guide.
Diffstat (limited to 'railties')
-rw-r--r-- | railties/doc/guides/source/configuring.txt | 74 |
1 files changed, 33 insertions, 41 deletions
diff --git a/railties/doc/guides/source/configuring.txt b/railties/doc/guides/source/configuring.txt index 07b630c59d..883cc43d36 100644 --- a/railties/doc/guides/source/configuring.txt +++ b/railties/doc/guides/source/configuring.txt @@ -20,6 +20,39 @@ after-initializer === Configuring Active Record ++ActiveRecord::Base+ includej a variety of configuration options: + ++logger+ accepts a logger conforming to the interface of Log4r or the default Ruby 1.8+ 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. + ++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: + +* +:table_name+ would make the primary key for the Customer class +customerid+ +* +:table_name_with_underscore+ would make the primary key for the Customer class +customer_id+ + ++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. + ++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. + ++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. + ++colorize_logging+ (true by default) specifies whether or not to use ANSI color codes when logging information from ActiveRecord. + ++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+. + ++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. + ++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. + ++lock_optimistically+ controls whether ActiveRecord will use optimistic locking. By default this is +true+. + +The MySQL adapter adds one additional configuration option: + ++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+. + +The schema dumper adds one additional configuration option: + ++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+. + === Configuring Action Controller === Configuring Action View @@ -135,47 +168,6 @@ 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 -activerecord/lib/active_record/base.rb -394: cattr_accessor :logger, :instance_writer => false -443: cattr_accessor :configurations, :instance_writer => false -450: cattr_accessor :primary_key_prefix_type, :instance_writer => false -456: cattr_accessor :table_name_prefix, :instance_writer => false -461: cattr_accessor :table_name_suffix, :instance_writer => false -467: cattr_accessor :pluralize_table_names, :instance_writer => false -473: cattr_accessor :colorize_logging, :instance_writer => false -478: cattr_accessor :default_timezone, :instance_writer => false -487: cattr_accessor :schema_format , :instance_writer => false -491: cattr_accessor :timestamped_migrations , :instance_writer => false - -activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb -11: cattr_accessor :connection_handler, :instance_writer => false - -activerecord/lib/active_record/connection_adapters/mysql_adapter.rb -166: cattr_accessor :emulate_booleans - -activerecord/lib/active_record/fixtures.rb -498: cattr_accessor :all_loaded_fixtures - -activerecord/lib/active_record/locking/optimistic.rb -38: base.cattr_accessor :lock_optimistically, :instance_writer => false - -activerecord/lib/active_record/migration.rb -259: cattr_accessor :verbose - -activerecord/lib/active_record/schema_dumper.rb -13: cattr_accessor :ignore_tables - -activerecord/lib/active_record/serializers/json_serializer.rb -4: base.cattr_accessor :include_root_in_json, :instance_writer => false - -activerecord/Rakefile -142: rdoc.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object' - -activerecord/test/cases/lifecycle_test.rb -61: cattr_reader :last_inherited - -activerecord/test/cases/mixin_test.rb -9: cattr_accessor :forced_now_time activeresource/lib/active_resource/base.rb 206: cattr_accessor :logger |