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 6728663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:11:50+00:00 2026-05-26T10:11:50+00:00

I’m facing a very strange bug with the make_voteable gem. Actually I’m not even

  • 0

I’m facing a very strange bug with the make_voteable gem. Actually I’m not even sure it’s related to make_voteable or if it’s a rake issue.

My application has a Project model. Projects have a status attribute. They start as “Developing” and after the set development deadline is reached, the status changes to “Pending voting”. Then users can vote the projects up or down (until the voting deadline is reached) to prioritize them.

So if the status for a project is “Pending voting”, the project show view displays links to the following actions on my projects controller:

def vote_yes
  @project = Project.find(params[:id])
  current_user.up_vote(@project)
  flash[:success] = 'Thanks for voting!'
  redirect_to @project
rescue MakeVoteable::Exceptions::AlreadyVotedError
  flash[:error] = 'You already voted!'
  redirect_to @project
end

def vote_no
  @project = Project.find(params[:id])
  current_user.down_vote(@project)
  flash[:success] = 'Thanks for voting!'
  redirect_to @project
rescue MakeVoteable::Exceptions::AlreadyVotedError
  flash[:error] = 'You already voted!'
  redirect_to @project
end

Everything works great if I update the deadline/status/voting_deadline through the terminal or manually change the record on the database. Voting works as expected, with up_votes and down_votes being stores in the correspondent project record.

However if I run the cron job I setup to take care of this, which is the normal application workflow, the views render the voting links, the users can click them as usual, but no vote is stored on the projects table. The votings table, however, gets populated normally and the user is not able to vote again.

The only thing the cron job does is run this bit of code from the Project model:

def self.close_projects
  @finished_projects = Project.where('deadline < ? and status = ?', Time.now.utc, "Developing")
  @finished_projects.each do | project |
    project.update_attribute(:status, "Pending voting")
    project.update_attribute(:voting_deadline, Time.now.utc + 1.week )
  end
end

Just a last observation: I ran a migration to add the voting_deadline column to the projects table after running the migration that added the up/down_votes to the same model. I don’t think this should be an issue, but maybe it’s worth noticing.

I really appreciate any input.

  • 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-05-26T10:11:50+00:00Added an answer on May 26, 2026 at 10:11 am

    Turns out it was just a validation error that was not being raised by the gem. But it was my fault, completely, since the validation should occur only on create, and it was happening on updates too.

    However, I think the code for the gem could improve, pointing out errors like such, so I’ll provide some feedback at their github page.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text

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.