Skip to content

Commit d68419a

Browse files
committed
Merge pull request rails#12193 from arunagw/revert-revert
Revert fixes
2 parents 05f88b7 + 5374960 commit d68419a

File tree

19 files changed

+33
-41
lines changed

19 files changed

+33
-41
lines changed

actionmailer/lib/action_mailer/delivery_methods.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def wrap_delivery_behavior(mail, method=nil, options=nil) # :nodoc:
6464
raise "Delivery method cannot be nil"
6565
when Symbol
6666
if klass = delivery_methods[method]
67-
mail.delivery_method(klass,(send(:"#{method}_settings") || {}).merge!(options || {}))
67+
mail.delivery_method(klass, (send(:"#{method}_settings") || {}).merge(options || {}))
6868
else
6969
raise "Invalid delivery method #{method.inspect}"
7070
end

actionmailer/test/delivery_methods_test.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ def teardown
152152
assert_equal "overridden", delivery_method_instance.settings[:user_name]
153153
assert_equal "somethingobtuse", delivery_method_instance.settings[:password]
154154
assert_equal delivery_method_instance.settings.merge(overridden_options), delivery_method_instance.settings
155+
156+
# make sure that overriding delivery method options per mail instance doesn't affect the Base setting
157+
assert_equal settings, ActionMailer::Base.smtp_settings
155158
end
156159

157160
test "non registered delivery methods raises errors" do

actionpack/lib/action_dispatch/routing/route_set.rb

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -514,11 +514,12 @@ def initialize(options, recall, set)
514514
@recall = recall.dup
515515
@set = set
516516

517+
normalize_recall!
517518
normalize_options!
518519
normalize_controller_action_id!
519520
use_relative_controller!
520521
normalize_controller!
521-
handle_nil_action!
522+
normalize_action!
522523
end
523524

524525
def controller
@@ -537,6 +538,11 @@ def use_recall_for(key)
537538
end
538539
end
539540

541+
# Set 'index' as default action for recall
542+
def normalize_recall!
543+
@recall[:action] ||= 'index'
544+
end
545+
540546
def normalize_options!
541547
# If an explicit :controller was given, always make :action explicit
542548
# too, so that action expiry works as expected for things like
@@ -552,8 +558,8 @@ def normalize_options!
552558
options[:controller] = options[:controller].to_s
553559
end
554560

555-
if options[:action]
556-
options[:action] = options[:action].to_s
561+
if options.key?(:action)
562+
options[:action] = (options[:action] || 'index').to_s
557563
end
558564
end
559565

@@ -563,8 +569,6 @@ def normalize_options!
563569
# :controller, :action or :id is not found, don't pull any
564570
# more keys from the recall.
565571
def normalize_controller_action_id!
566-
@recall[:action] ||= 'index' if current_controller
567-
568572
use_recall_for(:controller) or return
569573
use_recall_for(:action) or return
570574
use_recall_for(:id)
@@ -586,13 +590,11 @@ def normalize_controller!
586590
@options[:controller] = controller.sub(%r{^/}, '') if controller
587591
end
588592

589-
# This handles the case of action: nil being explicitly passed.
590-
# It is identical to action: "index"
591-
def handle_nil_action!
592-
if options.has_key?(:action) && options[:action].nil?
593-
options[:action] = 'index'
593+
# Move 'index' action from options to recall
594+
def normalize_action!
595+
if @options[:action] == 'index'
596+
@recall[:action] = @options.delete(:action)
594597
end
595-
recall[:action] = options.delete(:action) if options[:action] == 'index'
596598
end
597599

598600
# Generates a path from routes, returns [path, params].

actionpack/test/controller/new_base/render_streaming_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class StreamingTest < Rack::TestCase
9292
io.rewind
9393
assert_match "(undefined method `invalid!' for nil:NilClass)", io.read
9494
ensure
95-
ActionController::Base.logger = _old
95+
ActionView::Base.logger = _old
9696
end
9797
end
9898

activerecord/test/models/author.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ class Author < ActiveRecord::Base
88
has_many :posts_sorted_by_id_limited, -> { order('posts.id').limit(1) }, :class_name => "Post"
99
has_many :posts_with_categories, -> { includes(:categories) }, :class_name => "Post"
1010
has_many :posts_with_comments_and_categories, -> { includes(:comments, :categories).order("posts.id") }, :class_name => "Post"
11-
has_many :posts_containing_the_letter_a, :class_name => "Post"
1211
has_many :posts_with_special_categorizations, :class_name => 'PostWithSpecialCategorization'
13-
has_many :posts_with_extension, :class_name => "Post"
1412
has_one :post_about_thinking, -> { where("posts.title like '%thinking%'") }, :class_name => 'Post'
1513
has_one :post_about_thinking_with_last_comment, -> { where("posts.title like '%thinking%'").includes(:last_comment) }, :class_name => 'Post'
1614
has_many :comments, through: :posts do
@@ -32,7 +30,6 @@ def ratings
3230
has_many :welcome_posts, -> { where(:title => 'Welcome to the weblog') }, :class_name => 'Post'
3331

3432
has_many :comments_desc, -> { order('comments.id DESC') }, :through => :posts, :source => :comments
35-
has_many :limited_comments, -> { limit(1) }, :through => :posts, :source => :comments
3633
has_many :funky_comments, :through => :posts, :source => :comments
3734
has_many :ordered_uniq_comments, -> { distinct.order('comments.id') }, :through => :posts, :source => :comments
3835
has_many :ordered_uniq_comments_desc, -> { distinct.order('comments.id DESC') }, :through => :posts, :source => :comments

activerecord/test/models/auto_id.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
class AutoId < ActiveRecord::Base
2-
def self.table_name () "auto_id_tests" end
3-
def self.primary_key () "auto_id" end
2+
self.table_name = "auto_id_tests"
3+
self.primary_key = "auto_id"
44
end

activerecord/test/models/car.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
class Car < ActiveRecord::Base
2-
32
has_many :bulbs
43
has_many :funky_bulbs, class_name: 'FunkyBulb', dependent: :destroy
54
has_many :foo_bulbs, -> { where(:name => 'foo') }, :class_name => "Bulb"
6-
has_many :frickinawesome_bulbs, -> { where :frickinawesome => true }, :class_name => "Bulb"
75

86
has_one :bulb
9-
has_one :frickinawesome_bulb, -> { where :frickinawesome => true }, :class_name => "Bulb"
107

118
has_many :tyres
129
has_many :engines, :dependent => :destroy

activerecord/test/models/citation.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
class Citation < ActiveRecord::Base
22
belongs_to :reference_of, :class_name => "Book", :foreign_key => :book2_id
3-
4-
belongs_to :book1, :class_name => "Book", :foreign_key => :book1_id
5-
belongs_to :book2, :class_name => "Book", :foreign_key => :book2_id
63
end

activerecord/test/models/club.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ class Club < ActiveRecord::Base
22
has_one :membership
33
has_many :memberships, :inverse_of => false
44
has_many :members, :through => :memberships
5-
has_many :current_memberships
65
has_one :sponsor
76
has_one :sponsored_member, :through => :sponsor, :source => :sponsorable, :source_type => "Member"
87
belongs_to :category

activerecord/test/models/company.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ class Firm < Company
4949
has_many :clients_like_ms, -> { where("name = 'Microsoft'").order("id") }, :class_name => "Client"
5050
has_many :clients_like_ms_with_hash_conditions, -> { where(:name => 'Microsoft').order("id") }, :class_name => "Client"
5151
has_many :plain_clients, :class_name => 'Client'
52-
has_many :readonly_clients, -> { readonly }, :class_name => 'Client'
5352
has_many :clients_using_primary_key, :class_name => 'Client',
5453
:primary_key => 'name', :foreign_key => 'firm_name'
5554
has_many :clients_using_primary_key_with_delete_all, :class_name => 'Client',
@@ -167,7 +166,6 @@ class ExclusivelyDependentFirm < Company
167166
has_one :account, :foreign_key => "firm_id", :dependent => :delete
168167
has_many :dependent_sanitized_conditional_clients_of_firm, -> { order("id").where("name = 'BigShot Inc.'") }, :foreign_key => "client_of", :class_name => "Client", :dependent => :delete_all
169168
has_many :dependent_conditional_clients_of_firm, -> { order("id").where("name = ?", 'BigShot Inc.') }, :foreign_key => "client_of", :class_name => "Client", :dependent => :delete_all
170-
has_many :dependent_hash_conditional_clients_of_firm, -> { order("id").where(:name => 'BigShot Inc.') }, :foreign_key => "client_of", :class_name => "Client", :dependent => :delete_all
171169
end
172170

173171
class SpecialClient < Client

activerecord/test/models/member.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ class Member < ActiveRecord::Base
22
has_one :current_membership
33
has_one :selected_membership
44
has_one :membership
5-
has_many :fellow_members, :through => :club, :source => :members
65
has_one :club, :through => :current_membership
76
has_one :selected_club, :through => :selected_membership, :source => :club
87
has_one :favourite_club, -> { where "memberships.favourite = ?", true }, :through => :membership, :source => :club

activerecord/test/models/movie.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
class Movie < ActiveRecord::Base
2-
def self.primary_key
3-
"movieid"
4-
end
2+
self.primary_key = "movieid"
53
end

activerecord/test/models/post.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ def add_joins_and_select
130130
has_many :secure_readers
131131
has_many :readers_with_person, -> { includes(:person) }, :class_name => "Reader"
132132
has_many :people, :through => :readers
133-
has_many :secure_people, :through => :secure_readers
134133
has_many :single_people, :through => :readers
135134
has_many :people_with_callbacks, :source=>:person, :through => :readers,
136135
:before_add => lambda {|owner, reader| log(:added, :before, reader.first_name) },

activerecord/test/models/project.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
class Project < ActiveRecord::Base
22
has_and_belongs_to_many :developers, -> { distinct.order 'developers.name desc, developers.id desc' }
33
has_and_belongs_to_many :readonly_developers, -> { readonly }, :class_name => "Developer"
4-
has_and_belongs_to_many :selected_developers, -> { distinct.select "developers.*" }, :class_name => "Developer"
54
has_and_belongs_to_many :non_unique_developers, -> { order 'developers.name desc, developers.id desc' }, :class_name => 'Developer'
65
has_and_belongs_to_many :limited_developers, -> { limit 1 }, :class_name => "Developer"
76
has_and_belongs_to_many :developers_named_david, -> { where("name = 'David'").distinct }, :class_name => "Developer"

activerecord/test/models/topic.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ def two
3434

3535
has_many :replies, :dependent => :destroy, :foreign_key => "parent_id"
3636
has_many :approved_replies, -> { approved }, class_name: 'Reply', foreign_key: "parent_id", counter_cache: 'replies_count'
37-
has_many :replies_with_primary_key, :class_name => "Reply", :dependent => :destroy, :primary_key => "title", :foreign_key => "parent_title"
3837

3938
has_many :unique_replies, :dependent => :destroy, :foreign_key => "parent_id"
4039
has_many :silly_unique_replies, :dependent => :destroy, :foreign_key => "parent_id"

activesupport/lib/active_support/core_ext/object/try.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def try(*a, &b)
4747
end
4848

4949
# Same as #try, but will raise a NoMethodError exception if the receiving is not nil and
50-
# does not implemented the tried method.
50+
# does not implement the tried method.
5151
def try!(*a, &b)
5252
if a.empty? && block_given?
5353
yield self

activesupport/test/transliterate_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
require 'active_support/inflector/transliterate'
44

55
class TransliterateTest < ActiveSupport::TestCase
6-
76
def test_transliterate_should_not_change_ascii_chars
87
(0..127).each do |byte|
98
char = [byte].pack("U")
@@ -24,12 +23,13 @@ def test_transliterate_should_approximate_ascii
2423
def test_transliterate_should_work_with_custom_i18n_rules_and_uncomposed_utf8
2524
char = [117, 776].pack("U*") # "ü" as ASCII "u" plus COMBINING DIAERESIS
2625
I18n.backend.store_translations(:de, :i18n => {:transliterate => {:rule => {"ü" => "ue"}}})
27-
I18n.locale = :de
26+
default_locale, I18n.locale = I18n.locale, :de
2827
assert_equal "ue", ActiveSupport::Inflector.transliterate(char)
28+
ensure
29+
I18n.locale = default_locale
2930
end
3031

3132
def test_transliterate_should_allow_a_custom_replacement_char
3233
assert_equal "a*b", ActiveSupport::Inflector.transliterate("a索b", "*")
3334
end
34-
3535
end

guides/source/_welcome.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</p>
1616
<% end %>
1717
<p>
18-
The guides for Rails 3.2.x are available at <a href="http://guides.rubyonrails.org/v3.2.13/">http://guides.rubyonrails.org/v3.2.13/</a>.
18+
The guides for Rails 3.2.x are available at <a href="http://guides.rubyonrails.org/v3.2.14/">http://guides.rubyonrails.org/v3.2.14/</a>.
1919
</p>
2020
<p>
2121
The guides for Rails 2.3.x are available at <a href="http://guides.rubyonrails.org/v2.3.11/">http://guides.rubyonrails.org/v2.3.11/</a>.

railties/lib/rails/engine.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,13 @@ def inherited(base)
351351
Rails::Railtie::Configuration.eager_load_namespaces << base
352352

353353
base.called_from = begin
354-
# Remove the line number from backtraces making sure we don't leave anything behind
355-
call_stack = caller.map { |p| p.sub(/:\d+.*/, '') }
354+
call_stack = if Kernel.respond_to?(:caller_locations)
355+
caller_locations.map(&:path)
356+
else
357+
# Remove the line number from backtraces making sure we don't leave anything behind
358+
caller.map { |p| p.sub(/:\d+.*/, '') }
359+
end
360+
356361
File.dirname(call_stack.detect { |p| p !~ %r[railties[\w.-]*/lib/rails|rack[\w.-]*/lib/rack] })
357362
end
358363
end

0 commit comments

Comments
 (0)