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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:34:38+00:00 2026-05-20T17:34:38+00:00

I have two questions about undefined method `distance_of_time_in_words’ In my view I am attempting

  • 0

I have two questions about undefined method `distance_of_time_in_words’

In my view I am attempting this, and get undefined method:

<td><%= distance_of_time_in_words (patient_course_step.started, patient_course_step.completed) %></td>

I really want to use this in my model to create a “helper method” for my model.

Examples of helper methods in model:

def duration
   distance_of_time_in_words (self.started, self.completed)
end

def status
    if started.nil?
      created_at_formated = created_at.strftime("%B %d, %Y, %l:%M %p")
      return "Not started assigned on #{created_at_formated}"
    elsif !completed.nil?
      completed_formated = completed.strftime("%B %d, %Y, %l:%M %p")
      return "Completed at #{completed_formated}"
    else
      last_viewed_formated = last_viewed.strftime("%B %d, %Y, %l:%M %p")
      return "In Progress, last viewed at #{last_viewed_formated}"
    end
  end
  1. How can I get distance_of_time_in_words to work in my view
  2. Is it a good practice to have helper methods in a model (as shown above)
  • 1 1 Answer
  • 1 View
  • 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-20T17:34:39+00:00Added an answer on May 20, 2026 at 5:34 pm

    It’s not good practice to do this, but I understand the need for it. See this snippet on DZone on how to do it.

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

Sidebar

Related Questions

I'm building this website and I have basically two questions about this page: http://sites.publishyours.com.br/silviamecozzi/pt/obra/deserto_das_palmas.php
I have two questions about this: I am trying to assign an image to
I have two questions about this homework assignment: Write an assembly language program in
I have two questions about java.awt.Shape . Suppose I have two Shape s, shape1
So I have two questions about HashMap s in Java: What is the correct
I have two noobish questions about Flash, Actionscript, Flex etc. 1) With these technologies
So basically, I have two fast questions about kohana urls. 1) With default .htaccess
I have two questions about using a BackgroundWorker: 1)Lets say you have Function A
I have two questions about Google's dense_hash_map , which can be used instead of
I have a two questions about authentication involving CouchDB. The questions are about a

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.