In Rails while using the `where` method, how to match only the year and month? -



In Rails while using the `where` method, how to match only the year and month? -

normally, select records same date utilize :

bronze.where(regdate: date.new(2014,03,03))

how can utilize select year , month?

for month be:

date = # set date here bronze.where(regdate: date.beginning_of_month...date.beginning_of_month + 1.month)

analogically year.

ruby-on-rails ruby-on-rails-4

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -