Method: Babik::Selection::Operation::Month#sql_function
- Defined in:
- lib/babik/queryset/lib/selection/operation/date.rb
#sql_function ⇒ Object
74 75 76 77 78 79 80 |
# File 'lib/babik/queryset/lib/selection/operation/date.rb', line 74 def sql_function dbms_adapter = db_engine return 'MONTH(#field)' if dbms_adapter == 'mysql2' return 'EXTRACT(MONTH FROM #field)' if dbms_adapter == 'postgresql' return 'strftime(\'%m\', #field)' if dbms_adapter == 'sqlite3' raise NotImplementedError, "#{self.class} lookup not implemented for #{dbms_adapter}" end |