title: Rails update database after certain amount of time has gone by
body: <p>I am trying to update a column in my database if a book was created more than 25 seconds ago (when deploying, it will be 7 days ago, but I can't wait that long :)).</p>
  
  <p><strong>Models:</strong></p>
  
  <pre><code>class Book &lt; ActiveRecord::Base
    attr_accessible :author, :date, :description, :order, :title, :user_id, :author, :status, :queued
    belongs_to :user
  end
  
  class User &lt; ActiveRecord::Base
    attr_accessible :email, :password, :password_confirmation, :remember_me, :user_id, :name, :bio
    has_many :books
  end
  </code></pre>
  
  <p><strong>Controller:</strong></p>
  
  <pre><code>class UsersController &lt; ApplicationController
  
  def show
    @user = User.find(params[:id])
  
    @book = Book.new
  
    @books = Book.select("DISTINCT name, id") # Not used right now
  
    @sequence = @user.books
  
    @sequence.each do |book|
      book.created_at &gt;= 25.seconds.ago ? book.queued = false : nil
    end
  end
  </code></pre>
  
  <p><strong>User show view:</strong></p>
  
  <pre><code>&lt;% @sequence.order("created_at DESC").where(:queued =&gt; false).each do |book| %&gt;
  </code></pre>
  
  <p>Am I even close to getting this to work? What am I doing wrong? As you can see, I want to change the "queued" attribute to false after 25 seconds...</p>
  
  <p><strong>Edit</strong></p>
  
  <p>I've been told I need to use something like Heroku's Scheduler for this to work. Is there no way for this to update the database without something like that?</p>