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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:03:33+00:00 2026-05-30T21:03:33+00:00

EDIT: I moved the time math into the model as a callback. I’m getting

  • 0

EDIT: I moved the time math into the model as a callback. I’m getting this error:

NoMethodError in OutstandingsController#create
undefined method `hours' for nil:NilClass

Is there some gem that I need to include to be able to do the time math? I thought it was included in ActiveSupport..?

class Outstanding < ActiveRecord::Base
  belongs_to :user

  before_validation(:on => :create) do
    self.panic_deadline = Time.now
    self.panic_deadline = self.panic_deadline + self.deadline_hours.hours
    self.panic_deadline = self.panic_deadline + self.deadline_minutes.minutes

    self.active = true
  end
end

class OutstandingsController < ApplicationController

def create
    @outstanding = Outstanding.new(params[:outstanding])
    @user = current_user
    @outstanding.user_id=@user.id

    respond_to do |format|
      if @outstanding.save ...

<%= form_for(@outstanding) do |f| %>
  <div class="field">
    <%= select_tag :deadline_hours, options_for_select(Array(0..99), 0)  %><%= f.label :deadline_hours %>
    <%= select_tag :deadline_mins, options_for_select(Array(1..59), 30) %><%= f.label :deadline_mins %>
  </div>
  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>
  • 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-30T21:03:34+00:00Added an answer on May 30, 2026 at 9:03 pm

    Maybe something like

    panic_deadline = Time.now
    panic_deadline = panic_deadline + @outstanding.deadline_hours.hours
    panic_deadline = panic_deadline + @outstanding.deadline_minutes.minutes
    

    Make sure that there is either a virtual attribute for deadline_hours / deadline_minutes or it’s in the model schema.

    class Outstanding < ACtiveRecord::Base
      belongs_to :user
    
      before_validation(:on => :create) do
        self.panic_deadline = Time.now
        self.panic_deadline = self.panic_deadline + self.deadline_hours.hours
        self.panic_deadline = self.panic_deadline + self.deadline_minutes.minutes
        self.active = true
      end
    
      attr_accessor           :deadline_hours, :deadline_minutes
    
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Edit: This question was written in 2008, which was like 3 internet ages ago.
EDIT: This was formerly more explicitly titled: - Best solution to stop Kontiki's KHOST.EXE
EDIT: This question is more about language engineering than C++ itself. I used C++
Edit: This was accidentally posted twice. Original: VB.NET Importing Classes I've seen some code
Edit: I have solved this by myself. See my answer below I have set
Edit: I'm rewriting this question because I apparently wasn't clear. Sometimes the GPS service
This has to do with media uploading in Wordpress. Every time WP creates a
Edit : Moved the actual question to the top. Update : Found an example
Every time I initiate company-mode with M-x company-mode this message shows up: Company back-end
EDIT This question has been closed on SO and reposted on ServerFault https://serverfault.com/questions/333168/how-can-i-make-my-ssis-process-consume-more-resources-and-run-faster I

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.