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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Zach Inglis // LT3media
2007-Jun-10 12:51 UTC
Re: Controlling when an application is open?
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 Inglis → Blog -- http://www.zachinglis.com → Company -- http://www.lt3media.com → Portfolio -- http://portfolio.zachinglis.com On Jun 9, 2007, at 9:48 AM, Daniel Legrand wrote:> > 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. > > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---