diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2017-06-02 12:24:31 -0400 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2017-06-02 12:24:31 -0400 |
commit | 62d316c6d88595940d6da08b3e6c97f9ca2aec1d (patch) | |
tree | 49ae0076ff12a85d588857ef2864dbf1dd09cc81 /activerecord/test/models | |
parent | feefa9fc9803780713f61c6eded0785e3844a681 (diff) | |
parent | f7388635f246b97a1aa0be54579339c6659fb865 (diff) | |
download | rails-62d316c6d88595940d6da08b3e6c97f9ca2aec1d.tar.gz rails-62d316c6d88595940d6da08b3e6c97f9ca2aec1d.tar.bz2 rails-62d316c6d88595940d6da08b3e6c97f9ca2aec1d.zip |
Merge branch 'master' into unlock-minitest
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/comment.rb | 12 | ||||
-rw-r--r-- | activerecord/test/models/company.rb | 1 | ||||
-rw-r--r-- | activerecord/test/models/numeric_data.rb | 8 | ||||
-rw-r--r-- | activerecord/test/models/post.rb | 2 |
4 files changed, 22 insertions, 1 deletions
diff --git a/activerecord/test/models/comment.rb b/activerecord/test/models/comment.rb index 76b484e616..d227f6fe86 100644 --- a/activerecord/test/models/comment.rb +++ b/activerecord/test/models/comment.rb @@ -19,6 +19,18 @@ class Comment < ActiveRecord::Base has_many :children, class_name: "Comment", foreign_key: :parent_id belongs_to :parent, class_name: "Comment", counter_cache: :children_count + class ::OopsError < RuntimeError; end + + module OopsExtension + def destroy_all(*) + raise OopsError + end + end + + default_scope { extending OopsExtension } + + scope :oops_comments, -> { extending OopsExtension } + # Should not be called if extending modules that having the method exists on an association. def self.greeting raise diff --git a/activerecord/test/models/company.rb b/activerecord/test/models/company.rb index d269a95e8c..c6a5bf1c92 100644 --- a/activerecord/test/models/company.rb +++ b/activerecord/test/models/company.rb @@ -175,6 +175,7 @@ end class ExclusivelyDependentFirm < Company has_one :account, foreign_key: "firm_id", dependent: :delete has_many :dependent_sanitized_conditional_clients_of_firm, -> { order("id").where("name = 'BigShot Inc.'") }, foreign_key: "client_of", class_name: "Client", dependent: :delete_all + has_many :dependent_hash_conditional_clients_of_firm, -> { order("id").where(name: "BigShot Inc.") }, foreign_key: "client_of", class_name: "Client", dependent: :delete_all has_many :dependent_conditional_clients_of_firm, -> { order("id").where("name = ?", "BigShot Inc.") }, foreign_key: "client_of", class_name: "Client", dependent: :delete_all end diff --git a/activerecord/test/models/numeric_data.rb b/activerecord/test/models/numeric_data.rb new file mode 100644 index 0000000000..c6e025a9ce --- /dev/null +++ b/activerecord/test/models/numeric_data.rb @@ -0,0 +1,8 @@ +class NumericData < ActiveRecord::Base + self.table_name = "numeric_data" + # Decimal columns with 0 scale being automatically treated as integers + # is deprecated, and will be removed in a future version of Rails. + attribute :world_population, :big_integer + attribute :my_house_population, :big_integer + attribute :atoms_in_universe, :big_integer +end diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb index a2028b3eb9..4c913b3b72 100644 --- a/activerecord/test/models/post.rb +++ b/activerecord/test/models/post.rb @@ -13,7 +13,7 @@ class Post < ActiveRecord::Base module NamedExtension2 def greeting - "hello" + "hullo" end end |