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

  • Home
  • SEARCH
  • 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 8154959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:31:28+00:00 2026-06-06T16:31:28+00:00

It was working few days ago, don’t know what had went wrong… **undefined method

  • 0

It was working few days ago, don’t know what had went wrong…

**undefined method `name' for nil:NilClass**

Extracted source (around line #26):

23:             %td= number_with_precision(employee.compensation_leave_balance, precision:1)
24:   #calendar.tab-pane.fade
25:     = calendar(:year => 2012, :month => 6, :first_day_of_week => 1, summary: "Leave Calendar", calendar_title: "June", month_header: true) do |date|
26:       - render_leave_calendar_cell(date)
27:   #trash.tab-pane.fade
28:     = render 'table', leaves: @leaves.where(deleted: true)

app/helpers/leaves_helper.rb:11:in `block in events_for'
app/helpers/leaves_helper.rb:10:in `events_for'
app/helpers/leaves_helper.rb:4:in `render_leave_calendar_cell'
app/views/human_resources/leaves/index.html.haml:26:in `block in _app_views_human_resources_leaves_index_html_haml__145883348_88978910'
app/helpers/calendar_helper.rb:146:in `call'
app/helpers/calendar_helper.rb:146:in `block in calendar'
app/helpers/calendar_helper.rb:145:in `upto'
app/helpers/calendar_helper.rb:145:in `calendar'
app/views/human_resources/leaves/index.html.haml:25:in `_app_views_human_resources_leaves_index_html_haml__145883348_88978910'

really don’t know what went wrong

a/h/leaves_helper.rb                                                                                                                        
   1 module LeavesHelper
   2   def render_leave_calendar_cell(date)
   3     html = content_tag(:span, date.day, class: 'dayDisplay')
   4     html += content_tag(:div, events_for(date))
   5     raw(html)
   6   end
   7 
   8   def events_for(date)                                                                                                                  
   9     html = ""
  10     current_company.leaves.where("start_date <= '#{date}' and return_date > '#{date}'").where(deleted: false).each do |leave|
  11       html += content_tag(:div, leave.applicant.name, class: 'leaveName')
  12     end
  13     raw html
  14   end

could it be the date nil? how to fix this ><

much appreciate
Billy

  • 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-06T16:31:30+00:00Added an answer on June 6, 2026 at 4:31 pm

    as abhas already stated, leave.applicant is nil for at least one of the leaves.

    go to your database and find out which it is. then figure out what to do with your leaves. delete them too, re-add the missing applicant or what ever data migration might be sensible.

    a quick fix would be to skip if an applicant is missing:

    html += content_tag(:div, leave.applicant.name, class: 'leaveName') if leave.applicant.present?
    

    i would also have a look if you properly configured the delete cascades in your application. this often causes such problems. if you want to enforce safety in this regard, you should add database constraints, that ensure that no referenced entity gets deleted.

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

Sidebar

Related Questions

Just started working with Mercurial a few days ago and there's something I don't
Up to a few days ago, Eclipse was working fine in locating the javadoc
I have started a new app a few days ago and began working with
I ordered Programming Windows Fifth Edition a few days ago, and started working with
I am using jQuery-1.4.2 with CakePHP and a few days ago I had this
I've been working on a RESTful webservice with spring-data. A few days ago a
I have a Google Maps KML feed which stopped working a few days ago.
A few days ago, I started working with cocos2d. I really like the framework.
I have an app which was working fine few days ago. But today I'm
A few days ago I've installed on my laptop Xubuntu 12.04. I had some

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.