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

2011-12-13 Thread amvis
*Date.today.month or Time.now.month* to get the month then how will continue. i think about that on how to continue. But i can't proceed. i need to take the each month report from the one year. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Ta

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

2011-12-13 Thread Michael Pavling
On 13 Dec 2011 08:08, "amvis" wrote: > any idea to select that? i have to fetch the data in each month from database? Yes. what have you tried? -- 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 rub

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

2011-12-13 Thread amvis
Thanks for the reply. get each month data between year. ie [ 2010-12-13 to 2011-12-13]. here i got this current date and last date in rails. have any idea to select that? i have to fetch the data in each month from database? Thank you vishnu -- You received this message because you are

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

2011-12-12 Thread Mukesh Singh
Read this http://guides.rubyonrails.org/active_record_querying.html On Tue, Dec 13, 2011 at 11:03 AM, amvis wrote: > * last_year* = 1.year.ago > > SELECT count(id) from customers where created_at > *"2010-12-13"* > > In the above query i need to change into a variable* last_year instead of > "

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

2011-12-12 Thread amvis
* last_year* = 1.year.ago SELECT count(id) from customers where created_at > *"2010-12-13"* In the above query i need to change into a variable* last_year instead of "2010-12-13" *. and how to convert this MySQL query into rails query. also give me a link to study the rails queries Thank you v

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

2011-12-12 Thread Frederick Cheung
On Dec 12, 4:56 pm, amvis 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