test/model/book.rb in second_level_cache-2.5.3 vs test/model/book.rb in second_level_cache-2.6.0
- old
+ new
@@ -5,13 +5,16 @@
t.string :body
t.integer :user_id
t.decimal :discount_percentage, precision: 5, scale: 2
t.integer :images_count, default: 0
t.date :publish_date
+ t.boolean :normal, default: true, nil: false
end
class Book < ActiveRecord::Base
second_level_cache
+
+ default_scope -> { where(normal: true) }
belongs_to :user, counter_cache: true
has_many :images, as: :imagable
end