Controlling when an application is open?

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.

In application controller:
before_filter ( :can_run_this_date }

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

else

end
end

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

Cheers,
Zach I.
→ Blog – http://www.zachinglis.com
→ Company – http://www.lt3media.com
→ Portfolio – http://portfolio.zachinglis.com

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs