Skip to content

Commit 7f3205a

Browse files
wangjohnrafaelfranca
authored andcommitted
Renamed ApplicationModel to ApplicationRecord.
This new name is less general and more appropriate since these changes are limited to Active Record.
1 parent c0f1100 commit 7f3205a

File tree

190 files changed

+470
-468
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

190 files changed

+470
-468
lines changed

activerecord/lib/active_record/aggregations.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def clear_aggregation_cache #:nodoc:
1515
# existing object) and how it can be turned back into attributes (when the entity is saved to
1616
# the database).
1717
#
18-
# class Customer < ApplicationModel
18+
# class Customer < ApplicationRecord
1919
# composed_of :balance, class_name: "Money", mapping: %w(balance amount)
2020
# composed_of :address, mapping: [ %w(address_street street), %w(address_city city) ]
2121
# end
@@ -136,7 +136,7 @@ def clear_aggregation_cache #:nodoc:
136136
# or an array. The <tt>:constructor</tt> and <tt>:converter</tt> options can be used to meet
137137
# these requirements:
138138
#
139-
# class NetworkResource < ApplicationModel
139+
# class NetworkResource < ApplicationRecord
140140
# composed_of :cidr,
141141
# class_name: 'NetAddr::CIDR',
142142
# mapping: [ %w(network_address network), %w(cidr_range bits) ],

activerecord/lib/active_record/application_configuration.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@ module ApplicationConfiguration
44

55
module ClassMethods
66
def configs_from(mod)
7-
app_model = self
7+
app_record = self
88

99
mod.singleton_class.instance_eval do
10-
define_method(:application_model) { app_model }
10+
define_method(:application_record) { app_record }
1111
end
1212

1313
define_singleton_method(:configs_from_application) { application }
1414
end
1515

16-
def application_model(klass = nil)
16+
def application_record(klass = nil)
1717
return ActiveRecord::Base unless klass
1818

1919
klass = klass.class unless klass.respond_to?(:parents)
2020

21-
if klass.respond_to?(:application_model)
22-
klass.application_model
23-
elsif app_model = klass.parents.detect { |p| p.respond_to?(:application_model) }
24-
app_model
21+
if klass.respond_to?(:application_record)
22+
klass.application_record
23+
elsif app_record = klass.parents.detect { |p| p.respond_to?(:application_record) }
24+
app_record
2525
else
2626
ActiveRecord::Base
2727
end

0 commit comments

Comments
 (0)