diff options
-rw-r--r-- | actionpack/test/fixtures/test/change_priority.html.erb (renamed from actionpack/test/fixtures/test/change_priorty.html.erb) | 0 | ||||
-rw-r--r-- | actionpack/test/template/render_test.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/associations/join_dependency.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/associations/join_dependency/join_association.rb | 8 | ||||
-rw-r--r-- | activerecord/lib/active_record/reflection.rb | 10 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/big_decimal/conversions.rb | 1 | ||||
-rw-r--r-- | activesupport/test/core_ext/enumerable_test.rb | 6 | ||||
-rw-r--r-- | railties/lib/rails/generators/named_base.rb | 2 | ||||
-rw-r--r-- | railties/test/application/rake_test.rb | 6 | ||||
-rw-r--r-- | railties/test/commands/console_test.rb | 5 | ||||
-rw-r--r-- | railties/test/commands/dbconsole_test.rb | 4 |
11 files changed, 29 insertions, 17 deletions
diff --git a/actionpack/test/fixtures/test/change_priorty.html.erb b/actionpack/test/fixtures/test/change_priority.html.erb index 5618977d05..5618977d05 100644 --- a/actionpack/test/fixtures/test/change_priorty.html.erb +++ b/actionpack/test/fixtures/test/change_priority.html.erb diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb index 8111e58527..2237d747be 100644 --- a/actionpack/test/template/render_test.rb +++ b/actionpack/test/template/render_test.rb @@ -61,7 +61,7 @@ module RenderTestCases def test_render_partial_use_last_prepended_format_for_partials_with_the_same_names @view.lookup_context.formats = [:html] - assert_equal "\nHTML Template, but JSON partial", @view.render(:template => "test/change_priorty") + assert_equal "\nHTML Template, but JSON partial", @view.render(:template => "test/change_priority") end def test_render_template_with_a_missing_partial_of_another_format diff --git a/activerecord/lib/active_record/associations/join_dependency.rb b/activerecord/lib/active_record/associations/join_dependency.rb index e589959cf2..57fa6a8fc9 100644 --- a/activerecord/lib/active_record/associations/join_dependency.rb +++ b/activerecord/lib/active_record/associations/join_dependency.rb @@ -109,7 +109,7 @@ module ActiveRecord case associations when Symbol, String reflection = parent.reflections[associations.intern] or - raise ConfigurationError, "Association named '#{ associations }' was not found; perhaps you misspelled it?" + raise ConfigurationError, "Association named '#{ associations }' was not found on #{ parent.active_record.name }; perhaps you misspelled it?" unless join_association = find_join_association(reflection, parent) @reflections << reflection join_association = build_join_association(reflection, parent) diff --git a/activerecord/lib/active_record/associations/join_dependency/join_association.rb b/activerecord/lib/active_record/associations/join_dependency/join_association.rb index 0d3b4dbab1..a332034cb0 100644 --- a/activerecord/lib/active_record/associations/join_dependency/join_association.rb +++ b/activerecord/lib/active_record/associations/join_dependency/join_association.rb @@ -59,7 +59,7 @@ module ActiveRecord end end - def join_to(relation) + def join_to(manager) tables = @tables.dup foreign_table = parent_table foreign_klass = parent.active_record @@ -75,7 +75,7 @@ module ActiveRecord foreign_key = reflection.foreign_key when :has_and_belongs_to_many # Join the join table first... - relation.from(join( + manager.from(join( table, table[reflection.foreign_key]. eq(foreign_table[reflection.active_record_primary_key]) @@ -109,13 +109,13 @@ module ActiveRecord constraint = constraint.and(item.arel.constraints) unless item.arel.constraints.empty? end - relation.from(join(table, constraint)) + manager.from(join(table, constraint)) # The current table in this iteration becomes the foreign table in the next foreign_table, foreign_klass = table, reflection.klass end - relation + manager end def build_constraint(reflection, table, key, foreign_table, foreign_key) diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index 0995750ecd..2026511e38 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -401,6 +401,16 @@ module ActiveRecord # has_many :tags, through: :taggings # end # + # class Tagging < ActiveRecord::Base + # belongs_to :post + # belongs_to :tag + # end + # + # tags_reflection = Post.reflect_on_association(:tags) + # + # taggings_reflection = tags_reflection.source_reflection + # #=> <ActiveRecord::Reflection::AssociationReflection: @macro=:belongs_to, @name=:tag, @active_record=Tagging, @plural_name="tags"> + # def source_reflection @source_reflection ||= source_reflection_names.collect { |name| through_reflection.klass.reflect_on_association(name) }.compact.first end diff --git a/activesupport/lib/active_support/core_ext/big_decimal/conversions.rb b/activesupport/lib/active_support/core_ext/big_decimal/conversions.rb index 5dc5710c53..39b8cea807 100644 --- a/activesupport/lib/active_support/core_ext/big_decimal/conversions.rb +++ b/activesupport/lib/active_support/core_ext/big_decimal/conversions.rb @@ -1,4 +1,5 @@ require 'bigdecimal' +require 'bigdecimal/util' require 'yaml' class BigDecimal diff --git a/activesupport/test/core_ext/enumerable_test.rb b/activesupport/test/core_ext/enumerable_test.rb index 0a1abac767..6781e3c20e 100644 --- a/activesupport/test/core_ext/enumerable_test.rb +++ b/activesupport/test/core_ext/enumerable_test.rb @@ -24,10 +24,8 @@ class EnumerableTests < ActiveSupport::TestCase def test_group_by names = %w(marcel sam david jeremy) klass = Struct.new(:name) - objects = (1..50).inject([]) do |people,| - p = klass.new - p.name = names.sort_by { rand }.first - people << p + objects = (1..50).map do + klass.new names.sample end enum = GenericEnumerable.new(objects) diff --git a/railties/lib/rails/generators/named_base.rb b/railties/lib/rails/generators/named_base.rb index 8b4f52bb3b..d891ba1215 100644 --- a/railties/lib/rails/generators/named_base.rb +++ b/railties/lib/rails/generators/named_base.rb @@ -40,7 +40,7 @@ module Rails def indent(content, multiplier = 2) spaces = " " * multiplier - content = content.each_line.map {|line| line.blank? ? line : "#{spaces}#{line}" }.join + content.each_line.map {|line| line.blank? ? line : "#{spaces}#{line}" }.join end def wrap_with_namespace(content) diff --git a/railties/test/application/rake_test.rb b/railties/test/application/rake_test.rb index a9e0e1bcb7..4b8e813105 100644 --- a/railties/test/application/rake_test.rb +++ b/railties/test/application/rake_test.rb @@ -131,11 +131,11 @@ module ApplicationTests %w(run recent uncommitted models helpers units controllers functionals integration).each do |test_suit_name| output = Dir.chdir(app_path) { `rake test:#{test_suit_name} 2>&1` } - assert_match /DEPRECATION WARNING: `rake test:#{test_suit_name}` is deprecated/, output + assert_match(/DEPRECATION WARNING: `rake test:#{test_suit_name}` is deprecated/, output) end - assert_match /DEPRECATION WARNING: `rake test:single` is deprecated/, - Dir.chdir(app_path) { `rake test:single TEST=test/models/user_test.rb 2>&1` } + assert_match(/DEPRECATION WARNING: `rake test:single` is deprecated/, + Dir.chdir(app_path) { `rake test:single TEST=test/models/user_test.rb 2>&1` }) end def test_rake_routes_calls_the_route_inspector diff --git a/railties/test/commands/console_test.rb b/railties/test/commands/console_test.rb index 3c784b43be..a34beaedb3 100644 --- a/railties/test/commands/console_test.rb +++ b/railties/test/commands/console_test.rb @@ -114,9 +114,10 @@ class Rails::ConsoleTest < ActiveSupport::TestCase assert_match('dev', options[:environment]) end - private - attr_reader :output + private :output + + private def start(argv = []) rails_console = Rails::Console.new(app, parse_arguments(argv)) diff --git a/railties/test/commands/dbconsole_test.rb b/railties/test/commands/dbconsole_test.rb index 38fe8ca544..edb92b3aa2 100644 --- a/railties/test/commands/dbconsole_test.rb +++ b/railties/test/commands/dbconsole_test.rb @@ -172,8 +172,10 @@ class Rails::DBConsoleTest < ActiveSupport::TestCase assert_match(/Usage:.*dbconsole/, stdout) end - private attr_reader :aborted, :output + private :aborted, :output + + private def dbconsole @dbconsole ||= Rails::DBConsole.new(nil) |