From 0784dccc4fb8322ad88717efb31d37553542532b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Emin=20=C4=B0NA=C3=87?= Date: Sun, 14 Feb 2016 01:59:11 +0200 Subject: Execute default_scope defined by abstract class within the scope of subclass --- activerecord/test/models/cat.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 activerecord/test/models/cat.rb (limited to 'activerecord/test/models') 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 -- cgit v1.2.3