ruby - How do I compare dates in Rails? -
i'm trying compare dates in rails. created method:
def compare_dates = time.now.utc.to_date if == next_appointment_date return "today" else return "not today" end end
when call method in view, received "no today", if now
date , next_appointment_date
equals.
there helper method in rails datetime#today?
rewrite method to:
def compare_dates if next_appointment_date.today? "today" else "not today" end end
Comments
Post a Comment