#217 ✓resolved
Steve Kenworthy

Nil date error after loading fixtures

Reported by Steve Kenworthy | August 13th, 2010 @ 09:31 PM | in 0.9.10 "Alekhine"

On a standard ffcrm with demo fixtures loaded, I had the following error when trying to view the campaign dashboard.

ActionView::TemplateError (Object must be a Date, DateTime or Time object. nil given.) on line #14 of app/views/emails/_email.html.haml:
11:       = "To " << link_to(email.user.full_name, user_path(email.user))
12:       = "from " << link_to_email(email.sent_from) << ", sent on "
13:       = l(email.sent_at, :format => :mmddhhss)
14:       = " | " + link_to_function(email.collapsed? ? t(:more) : t(:less), "crm.flip_note_or_email(this, '#{t(:more)}', '#{t(:less)}')", :class => "toggle")
15: 
16:     %dt{ hidden_if(email.expanded?), :id => dom_id(email, :truncated) }
17:       %p

This was caused by an email having a nil sent_at date.

Turns out that when the email fixtures are generated, they may sometimes reference a campaign that doesn't exist - it picks a random number rand(100) to assign to the mediator_id but there are only 84 campaigns. This in turn, prevents the rake task from setting the correct dates as it doesn't find these emails.

Two solutions I could think of:

  1. Increase number of demo campaigns to over 100, or
  2. Reduce rand(100) to rand(80)

I chose method 2 and patched it here:

http://github.com/crossroads/fat_free_crm/commit/8c1568a4b4f474a085...

Hope that makes sense. and thanks for a great product.

Steve

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Ruby on Rails CRM platform for Web 2.0 and beyond

People watching this ticket

Tags

Pages