Reputation: 2466
Is it possible to update boolean to false (reset to false) when time reaches midnight, lets say 11:59pm?
I have a this:
t.boolean "status", :default => false
so when user clicks and updates the status to true, using this: @user.update_attribute(:status, true)
but i want to make it false on next day, possible ? thanks
Upvotes: 0
Views: 40
Reputation: 17949
00 00 * * * ruby path/to/your/midnight_script.sh
# midnight_script.sh
echo 'update "posts" set status = 'false' WHERE status = 'true';' | su - postgres -c "psql MYDBNAME"
Upvotes: 1