From fc05dcf303d566860b30c5d054012828d315baff Mon Sep 17 00:00:00 2001 From: Keith Date: Wed, 22 Feb 2017 14:36:08 +0800 Subject: [PATCH] fixed some issue --- app/models/dayoff.rb | 3 ++- app/views/plugin/memberlog/_profile.html.erb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/dayoff.rb b/app/models/dayoff.rb index 45454f1..3d3928b 100644 --- a/app/models/dayoff.rb +++ b/app/models/dayoff.rb @@ -2,7 +2,6 @@ class Dayoff < PersonalPluginIntro include Mongoid::Document include Mongoid::Timestamps - # validates :dayoff_description, :presence => true belongs_to :member_log, :dependent => :destroy @@ -11,5 +10,7 @@ class Dayoff < PersonalPluginIntro field :start_dayoff, :type => DateTime field :end_dayoff, :type => DateTime + validates :start_dayoff, :presence => true + validates :end_dayoff, :presence => true end \ No newline at end of file diff --git a/app/views/plugin/memberlog/_profile.html.erb b/app/views/plugin/memberlog/_profile.html.erb index 1ea1d15..78e0eb7 100644 --- a/app/views/plugin/memberlog/_profile.html.erb +++ b/app/views/plugin/memberlog/_profile.html.erb @@ -17,7 +17,7 @@
<% @dayoffs.each do |b| %> - <% if Time.now <= b.end_dayoff.to_date+40 %> + <% if Time.now.to_date <= b.end_dayoff.to_date+40 %>