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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -