# Please help(writing conditions using haml)

**URL:** <https://www.ruby-forum.com/t/please-help-writing-conditions-using-haml/186397>\
**Category:** Deployment\
**Created:** [April 6, 2010, 1:54pm UTC](https://www.ruby-forum.com/t/please-help-writing-conditions-using-haml/186397 "2010-04-06T13:54:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![murfhy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d26b3c/32.png) [@murfhy](https://www.ruby-forum.com/u/murfhy)\
**Post date:** [April 6, 2010, 1:54pm UTC](https://www.ruby-forum.com/t/please-help-writing-conditions-using-haml/186397/1 "2010-04-06T13:54:24Z")

</div>

in ma project there is a model named campaigns and delivery\_schedules .  
in delivery\_schedules i defined a method called below

def get\_scheduled\_time

self.delivery\_date.to\_s \<\< " " \<\< self.delivery\_hour.to\_s \<\< “:” \<\<  
self.delivery\_minute.to\_s \<\< " " \<\< self.delivery\_meridiem.upcase  
end  
in ma view page i write code lik this to print those values like this  
below

%dt  
%b #{t :delivery\_status}:  
= t(campaign.delivery\_status,:On\_Date,:time\_spec  
=\>campaign.delivery\_schedule.get\_scheduled\_time())

but i am gettting errors lik this

Showing app/views/campaigns/\_metrics.html.haml where line #19 raised:

You have a nil object when you didn’t expect it!  
The error occurred while evaluating nil.delivery\_schedule

also in a yml file i defined some parameters lik this

delivery\_status: Delivery Status  
on: on  
On\_Date: “On {{time\_spec}}”  
this is the result i am expecting

Scheduled On Mar 30, 2011 07:00 ( Scheduled On{{ value}}

can anyone pls help me or giv me idea to solve it
