Forum: Ruby on Rails Controlling when an application is open?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
868d6be1007c9ff2238abe0a6b4f7415?d=identicon&s=25 Daniel Legrand (daniel_l)
on 2007-06-09 16:48
I'm trying to figure out how to limit the dates an application runs.  I
have a table with "from" and "to" columns.  What I would like is for my
application to check these dates when it first starts up, and perform
actions depending on whether the current date falls within that range.
For instance, let's say I want my application to only be running during
the summertime, from June 1 to August 31.  In my table, I would have
"from" as 6/1/07 and "to" as 8/31/07.  I want the application to check
the current date (6/9/07) and, if the date falls within the given time
(which it does), I would like it to run the application as normal.
Otherwise, if it doesn't fall within that date range, it redirects to
another page telling the user that the application is down/not running,
etc.  Does RoR have an easy way to do this?  I searched a few forums and
googled some things, but couldn't find anything.  I'm not sure if this
is something a normal application does.  If anyone has any suggestions
or thoughts, I'd greatly appreciate them.  Thanks.
Df4978da52459529e539da4c995918cb?d=identicon&s=25 Zach Inglis // LT3media (Guest)
on 2007-06-10 14:55
(Received via mailing list)
In application controller:
before_filter ( :can_run_this_date }

def can_run_this_date
  if date_range.include?( # this line doesn't work, but it
should be something similair

Sorry I couldn't help anymore, Good luck though.

Zach Inglis
→ Blog --
→ Company --
→ Portfolio --
This topic is locked and can not be replied to.