Skip to content
Snippets Groups Projects
Commit 06a0cfc9 authored by Lucas Ernesto Kindinger's avatar Lucas Ernesto Kindinger
Browse files

Fix view model

parent 225fa50f
No related branches found
No related tags found
No related merge requests found
......@@ -6,12 +6,12 @@ class View < ActiveRecord::Base
before_create :current_time_greater_than_last
scope :created_last, ->(user) { where(user: user).order('created_at DESC').limit(1).first }
scope :created_last, ->(user) { where(user: user).order('created_at DESC').limit(1) }
private
def current_time_greater_than_last
last_view = viewable.views.created_last(user)
last_view = viewable.views.created_last(user).first
unless last_view.blank?
return false if Time.now < (last_view.created_at + 1.days)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment