aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-07-07 10:58:22 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-07-07 10:58:22 +0000
commit69d8ca4c525bfbf1ca617ea196aae2f29a3d0513 (patch)
tree079f045abde8c57f99586bb0b1328cc169952088 /activerecord
parentc4782f7393029eeacc599a7921939744d1fe22cd (diff)
downloadrails-69d8ca4c525bfbf1ca617ea196aae2f29a3d0513.tar.gz
rails-69d8ca4c525bfbf1ca617ea196aae2f29a3d0513.tar.bz2
rails-69d8ca4c525bfbf1ca617ea196aae2f29a3d0513.zip
Clearer has_one/belongs_to model names (account has_one :user). Closes #5632.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4577 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/CHANGELOG2
-rwxr-xr-xactiverecord/lib/active_record/associations.rb18
2 files changed, 12 insertions, 8 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG
index 68908acebd..20b5a7265a 100644
--- a/activerecord/CHANGELOG
+++ b/activerecord/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Clearer has_one/belongs_to model names (account has_one :user). #5632 [matt@mattmargolis.net]
+
* Oracle: use nonblocking queries if allow_concurrency is set, fix pessimistic locking, don't guess date vs. time by default (set OracleAdapter.emulate_dates = true for the old behavior), adapter cleanup. #5635 [schoenm@earthlink.net]
* Fixed a few Oracle issues: Allows Oracle's odd date handling to still work consistently within #to_xml, Passes test that hardcode insert statement by dropping the :id column, Updated RUNNING_UNIT_TESTS with Oracle instructions, Corrects method signature for #exec #5294 [schoenm@earthlink.net]
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index bf03a9bf1a..722f78596c 100755
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -118,25 +118,27 @@ module ActiveRecord
# Both express a 1-1 relationship, the difference is mostly where to place the foreign key, which goes on the table for the class
# saying belongs_to. Example:
#
- # class Post < ActiveRecord::Base
- # has_one :author
+ # class User < ActiveRecord::Base
+ # # I reference an account.
+ # belongs_to :account
# end
#
- # class Author < ActiveRecord::Base
- # belongs_to :post
+ # class Account < ActiveRecord::Base
+ # # One user references me.
+ # has_one :user
# end
#
# The tables for these classes could look something like:
#
- # CREATE TABLE posts (
+ # CREATE TABLE users (
# id int(11) NOT NULL auto_increment,
- # title varchar default NULL,
+ # account_id int(11) default NULL,
+ # name varchar default NULL,
# PRIMARY KEY (id)
# )
#
- # CREATE TABLE authors (
+ # CREATE TABLE accounts (
# id int(11) NOT NULL auto_increment,
- # post_id int(11) default NULL,
# name varchar default NULL,
# PRIMARY KEY (id)
# )