# Undefined method 'month'

**URL:** <https://www.ruby-forum.com/t/undefined-method-month/182610>\
**Category:** Rails\
**Created:** [January 30, 2010, 11:58pm UTC](https://www.ruby-forum.com/t/undefined-method-month/182610 "2010-01-30T23:58:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmaenpaa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9de053/32.png) [@jmaenpaa](https://www.ruby-forum.com/u/jmaenpaa)\
**Post date:** [January 30, 2010, 11:58pm UTC](https://www.ruby-forum.com/t/undefined-method-month/182610/1 "2010-01-30T23:58:31Z")

</div>

I get an undefined method month:

xml.haml:

- @results.each do |result|  
%set{:month =\> “#{result.month}”, :value =\> result.month}

Any suggestions?

---

<div class="post-metadata">

**Author:** ![jmaenpaa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9de053/32.png) [@jmaenpaa](https://www.ruby-forum.com/u/jmaenpaa)\
**Post date:** [January 31, 2010, 12:35am UTC](https://www.ruby-forum.com/t/undefined-method-month/182610/2 "2010-01-31T00:35:32Z")

</div>

John M. wrote:

> I get an undefined method month:
> 
> xml.haml:
> 
> - @results.each do |result|  
> %set{:month =\> “#{result.month}”, :value =\> result.month}
> 
> Any suggestions?

Actually I figured out why it was returning undefined. But with this

- @results.each do |result|  
%set{:value1 =\> “#{result.month}”}, {:value2 =\> “#{result.month}”}

My output shows empty values.

---

<div class="post-metadata">

**Author:** ![jmaenpaa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9de053/32.png) [@jmaenpaa](https://www.ruby-forum.com/u/jmaenpaa)\
**Post date:** [January 31, 2010, 12:44am UTC](https://www.ruby-forum.com/t/undefined-method-month/182610/3 "2010-01-31T00:44:37Z")

</div>

John M. wrote:

> John M. wrote:
> 
> > I get an undefined method month:
> > 
> > xml.haml:
> > 
> > - @results.each do |result|  
> > %set{:month =\> “#{result.month}”, :value =\> result.month}
> > 
> > Any suggestions?
> 
> Actually I figured out why it was returning undefined. But with this
> 
> - @results.each do |result|  
> %set{:value1 =\> “#{result.month}”}, {:value2 =\> “#{result.month}”}
> 
> My output shows empty values.

Ok I fixed that problem as well. However, it’s not displaying the total  
number of results by month though. I have more records than what are  
being showed when output.
