Ruby on rails pickadate在我的ror应用程序中不显示禁用天数

Ruby on rails pickadate在我的ror应用程序中不显示禁用天数,ruby-on-rails,calendar,pickadate,Ruby On Rails,Calendar,Pickadate,我的rails应用程序中的pickadate组件有问题。我无法禁用日历中的日期 我正在这个函数中加载模型中的禁用日期: def busy_days days = [] reservations.each do |reservation| reservation_start = ( reservation.reservation_start_date - 1.month) reservation_end = ( reservation.reservati

我的rails应用程序中的pickadate组件有问题。我无法禁用日历中的日期

我正在这个函数中加载模型中的禁用日期:

  def busy_days
    days = []
    reservations.each do |reservation|
      reservation_start = ( reservation.reservation_start_date - 1.month)
      reservation_end = ( reservation.reservation_end_date - 1.month)
      days << "{ from: [#{reservation_start.strftime("%Y,%-m,%d")}], to: [#{reservation_end.strftime("%Y,%-m,%d")}]}"
    end
    days.join(",")
  end
我的javascript如下所示:

- if @subject.reservations.present?
  %script
    var datesToDisable = ["#{@subject.busy_days}"]
    $(document).ready(function() { 
      $('.datepicker').pickadate({ 
       formatSubmit: 'yyyy/mm/dd',
       hiddenSuffix: '',
       disable: datesToDisable , 
       min: Date.now()
     })
   });
-  else
  %script
    $(document).ready(function() { 
     $('.datepicker').pickadate({ 
      formatSubmit: 'yyyy/mm/dd',
      hiddenSuffix: '' 
     })
   });

有什么建议吗?

我正在更新我的“忙碌日”功能,它现在可以工作了。

请帮助我:(我还没有解决这个问题。)
- if @subject.reservations.present?
  %script
    var datesToDisable = ["#{@subject.busy_days}"]
    $(document).ready(function() { 
      $('.datepicker').pickadate({ 
       formatSubmit: 'yyyy/mm/dd',
       hiddenSuffix: '',
       disable: datesToDisable , 
       min: Date.now()
     })
   });
-  else
  %script
    $(document).ready(function() { 
     $('.datepicker').pickadate({ 
      formatSubmit: 'yyyy/mm/dd',
      hiddenSuffix: '' 
     })
   });