db / migrate / 20160222115940_create_menus.rb
select rcp.CalendarPeriodId
,rc.CalendarId
,rcp.CalendarYearId
,rcp.PeriodNumber
,rcp.PeriodStartDate,rcp.PeriodEndDate
,CASE WHEN GETDATE() BETWEEN rcp.PeriodStartDate AND rcp.PeriodEndDate THEN 1 ELSE 0 END AS 'CurrentPeriod'
from RentCalendarPeriod rcp
LEFT JOIN RentCalendarYear rcy ON rcy.CalenderYearId = rcp.CalendarYearId
LEFT JOIN RentCalendar rc ON rc.CalendarId = rcy.CalendarId
应用程序/模型/ menu.rb
class CreateMenus < ActiveRecord::Migration
def change
create_table :menus do |t|
t.datetime :menu_date
t.timestamps null: false
end
end
end
我甚至在这里正确测试了正则表达式: - http://rubular.com/r/A8r8AGWgHv
你仍然可以看到它在终端输出中接受了错误的格式。