aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
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/lib/active_record
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/lib/active_record')
-rwxr-xr-xactiverecord/lib/active_record/associations.rb18
1 files changed, 10 insertions, 8 deletions
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)
# )