calendar_helper
def day_classes(day)
classes = []
classes.empty? ? nil : classes.join(" ")
classes << "future" if day > Date.today # This make future days a white background, by default days are blue background
# The Below Line Gives an Error (I want missed_dates date_missed to be red background):
classes << "missed" if day == current_user.missed_dates.group_by {|i| i.date_missed.to_date}
end
Pages#home中的NameError
undefined local variable or method 'current_user'
CSS
.future { background-color: #FFF; }
.missed { background-color: red; }
我使用railscasts tutorial建立日历。
答案 0 :(得分:1)
将此行添加到public static void main(String[] args) {
Scanner inp = new Scanner(System.in);
int i=0;
String in = inp.nextLine();
while(i==0){
if(in.equals("x")){
System.out.println("> y");
}else{
System.out.println("input != x");
}
in = inp.nextLine();
}
班级:
Calendar
由于delegate :current_user, to: :view
会自动包含在视图中,因此应该能够将SessionsHelper
变量传递给您的view
类。
感谢您删除了错误,但由于某种原因,我标记为date_missed的日期没有变成红色
我猜Calendar
是错过日期的数组,因此,为了检查您的日期是否在该数组中,请使用current_user.missed_dates.group_by {|i| i.date_missed.to_date}
:
include?