aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
authorMehmet Emin İNAÇ <mehmetemininac@gmail.com>2016-02-14 01:59:11 +0200
committerMehmet Emin İNAÇ <mehmetemininac@gmail.com>2016-03-08 14:56:00 +0200
commit0784dccc4fb8322ad88717efb31d37553542532b (patch)
treed6d72c74331ffa52ecae79acb13967683bcd0ffe /activerecord/test/models
parenta61bf5f5b63780a3e0b4c2d4339967df82b370de (diff)
downloadrails-0784dccc4fb8322ad88717efb31d37553542532b.tar.gz
rails-0784dccc4fb8322ad88717efb31d37553542532b.tar.bz2
rails-0784dccc4fb8322ad88717efb31d37553542532b.zip
Execute default_scope defined by abstract class within the scope of subclass
Diffstat (limited to 'activerecord/test/models')
-rw-r--r--activerecord/test/models/cat.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/activerecord/test/models/cat.rb b/activerecord/test/models/cat.rb
new file mode 100644
index 0000000000..e543d3aadb
--- /dev/null
+++ b/activerecord/test/models/cat.rb
@@ -0,0 +1,13 @@
+class Cat < ActiveRecord::Base
+ self.abstract_class = true
+
+ enum gender: [:female, :male]
+
+ scope :female, -> { where(gender: genders[:female]) }
+ scope :male, -> { where(gender: genders[:male]) }
+
+ default_scope -> { where(is_vegetarian: false) }
+end
+
+class Lion < Cat
+end