2016-03-01 42 views
0

我得到错误,而试图创建ics文件,请查看我的代码什么不对的:未初始化的常量PackagesController :: RiCal

uninitialized constant PackagesController::RiCal 

我需要包括或其他什么东西?

def i_cal 
    pack = Administration::MerchantPackage.find(params[:id]) 
    loc = pack.offering.merchant.address.to_s + pack.offering.merchant.city.to_s 
cal = RiCal.Calendar do 
    event do 
    description pack.subtitle 
    dtstart DateTime.parse(pack.start_date.strftime('%m/%d/%Y %H:%M:%S')) 
    dtend DateTime.parse(pack.end_date.strftime('%m/%d/%Y %H:%M:%S')) 
    location loc 
    add_attendee current_user.email rescue '' 
    alarm do 
     description "Segment 51" 
    end 
    end 
end 

当我尝试::RiCal.Calendar它给我的错误:

uninitialized constant RiCal

+2

格式化+语法 –

+1

您的Gemfile中是否有'ri_cal'?你有没有运行捆绑器?之后你有没有重新启动服务器? – BroiSatse

+0

非常感谢,这是错误的。 – shoaib

回答

1

在你的Gemfile:

gem 'ri_cal' 

然后导航至您的应用程序根目录并运行:

bundle install 

一旦完成你应该重新启动您的导轨服务器和IDE:

它看起来像是宝石未安装或应用程序可见的情况。