spec/test_classes/user.rb in baza_models-0.0.5 vs spec/test_classes/user.rb in baza_models-0.0.6
- old
+ new
@@ -12,19 +12,24 @@
validate :validate_custom_errors
validates_uniqueness_of :email, scope: :organization_id, if: :validate_uniqueness
validates_confirmation_of :email, if: :validate_confirmation
scope :admin_roles_scope, -> { joins(:roles).where(roles: {role: "administrator"}) }
+ scope :created_at_since, ->(date) { where("users.created_at >= ?", date) }
before_save do
self.before_save_block_called ||= 0
self.before_save_block_called += 1
end
# Used to test callbacks.
BazaModels::Model::CALLBACK_TYPES.each do |callback_type|
attr_reader "#{callback_type}_called"
__send__(callback_type, :add_callback, callback_type)
+ end
+
+ def self.ransackable_scopes(_auth_object = nil)
+ %i(created_at_since)
end
private
def add_callback(callback_type)