aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations.rb
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2007-03-27 14:04:06 +0000
committerRick Olson <technoweenie@gmail.com>2007-03-27 14:04:06 +0000
commit2a305949d756c054cee349c1ef3b39c6cf1496f8 (patch)
tree6de4aa3106b92e128a6b62dae9938b73a1f7ed03 /activerecord/lib/active_record/associations.rb
parent4b78a2a245cb69e958e3d62d4c0e6fcab2eb3e76 (diff)
downloadrails-2a305949d756c054cee349c1ef3b39c6cf1496f8.tar.gz
rails-2a305949d756c054cee349c1ef3b39c6cf1496f8.tar.bz2
rails-2a305949d756c054cee349c1ef3b39c6cf1496f8.zip
documentation project patches, closes #7342, #7319, #7316, #7190 [jeremymcanally]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6470 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/associations.rb')
-rwxr-xr-xactiverecord/lib/active_record/associations.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index c6eb4453ef..5393c3f91f 100755
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -798,6 +798,7 @@ module ActiveRecord
deprecated_association_comparison_method(reflection.name, reflection.class_name)
end
+ # Create the callbacks to update counter cache
if options[:counter_cache]
cache_column = options[:counter_cache] == true ?
"#{self.to_s.underscore.pluralize}_count" :
@@ -935,6 +936,12 @@ module ActiveRecord
end
private
+ # Generate a join table name from two provided tables names.
+ # The order of names in join name is determined by lexical precedence.
+ # join_table_name("members", "clubs")
+ # => "clubs_members"
+ # join_table_name("members", "special_clubs")
+ # => "members_special_clubs"
def join_table_name(first_table_name, second_table_name)
if first_table_name < second_table_name
join_table = "#{first_table_name}_#{second_table_name}"
@@ -944,7 +951,7 @@ module ActiveRecord
table_name_prefix + join_table + table_name_suffix
end
-
+
def association_accessor_methods(reflection, association_proxy_class)
define_method(reflection.name) do |*params|
force_reload = params.first unless params.empty?