Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8496103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:45:32+00:00 2026-06-10T23:45:32+00:00

I have a policy class and in that class I have 2 methods which

  • 0

I have a policy class and in that class I have 2 methods which determin whether or not a customer can renew their policy.

They look like this: (in the policy.rb model)

  def is_renewable?
    if has_not_been_renewed?
       self.ends_on >= Date.today && self.ends_on <= Date.today + 60.days
    end
  end

  def has_not_been_renewed?
    been_renewed = self.renewed_policy.nil? || !self.renewed_policy.active? || !self.active?
  end

So for some reason this is working on my local machine but not in our staging enviroment. (I know right, the bane of every programmer “But it works on my machine!”).

The logic seems simple: first check to make sure it hasn’t been renewed already or that they have a different active policy. Then check to make sure it hasn’t already expired and that it will expire sometime in the next 60 days.

This is called from this line in the view:

<%= link_to('Renew', {:action => 'renew', :id => policy.id}, {:class => 'btn btn-success'}) if policy.is_renewable? %>

I am really failing to see why this wouldn’t work anywhere. I wouldn’t ask but I have been looking at this stupid problem all day and need a new set of eyes to look it over. Thanks

Incase this helps, the format for both database’s (local and staging) is in the form:
yyyy-mm-dd so today’s date would be 2012-09-06.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T23:45:34+00:00Added an answer on June 10, 2026 at 11:45 pm

    Assuming you don’t have data integrity issues in you staging database (e.g. ends_on isn’t being set, you think there should be a renewed policy when there isn’t one), you might want to check the system clock and make sure it’s both accurate and using the timezone you’re expecting.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have that template class that uses a policy for it's output and another
I have a class that accepts a list of policy classes using boost::mpl. Each
I have two different versions of the constructor for my Policy class. I can't
I'm using Rampart to generate a request. I have a policy.xml that is used
Is it bad policy to have lots of work classes(such as Strategy classes), that
It looks like you can only have one lifecycle policy per plugin type in
In our organization we have some projects which are (by policy) open to all
Assuming that we only have one consumer and our redelivery policy will allow the
I have a small website hosted by my university. The policy is that no
have written this little class, which generates a UUID every time an object of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.