Home>
I want to compare the update_at of the data column with the current date and time
def edit
if check_token (params [: ett])
new
else
@title = 'expired'
render json: @title
end
end
def check_token (token)
employees = EmployeesToken.find_by (token: token)
return (employees.updated_at + 1.days)>= DateTime.now
end
employees.updated_at + 1.day is
Tue, 26 Nov 2019 14:06:44 JST +09: 00
DateTime.now is
Thu, 28 Nov 2019 15:54:40 + 0900I can't compare two values
return (employees.updated_at + 1.days)>= When processing DateTime.now, it will fall with an error.
I want to tell you if there are young people
-
Answer # 1
Related articles
- ruby - the last db setting doesn't work when deploying rails app on aws
- ruby on rails - missing required keys: i'm having trouble resolving the [: id] error
- ruby on rails - i want to implement a function for administrator users to register luggage for general users in rails
- ruby on rails - things associated with a foreign key cannot be called in view
- ruby on rails 6 - environment construction of ruby on rails
- ruby on rails 5 - actioncontroller :: invalidauthenticitytoken cannot be resolved
- ruby on rails - error in controller when transitioning with rails6 destory action
- ruby on rails - access fails after seed after deploying to heroku
- ruby on rails runtime error cannot be resolved
- ruby on rails 5 - some items are not saved in db when posting from rails form
- ruby on rails - rails s can't
- bootstrap display in ruby on rails is broken
- ruby - [rails] i can't install the add favorite button
- ruby on rails - dealing with wrong number of arguments (given 1, expected 2)
- ruby on rails - seed fails on heroku
- ruby on rails - cannot pass id to destroy action of intermediate table
- ruby on rails - how to manage prefectures in rails web applications
- ruby on rails - i want to post an image by dragging and dropping
- ruby - efficient writing of rails routing and actions
- ruby on rails - how to transition from the top page
Trends
return (employees.updated_at + 1.days) .to_datetime>= DateTime.now