Monday, December 12, 2011

[Rails] Re: problem on subtract one year from current year in ruby on rails

On Dec 12, 4:56 pm, amvis <vgrkrish...@gmail.com> wrote:
> in my machine i dn't have the local application setup. so just i try this
> two for display  that
>
> *puts last_year = Time.now.ago(1.year)  *or*  last_year = 1.year.ago*
>
> but it gives error  *undefined method `year' for 1:Fixnum (NoMethodError).*year is  builtin...?

The 1.year.ago stuff is rails only, so if you were in a pure ruby
console it wouldn't work

Fred

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate