草庐IT

event_end_date

全部标签

ruby-on-rails - Capistrano gzip : stdin: unexpected end of file interruption

我在Capistrano部署方面遇到问题。部署过程因Gzip错误而被丢弃。它可以是什么?capflowdeploy*executing`flow'*executing`deploy'*executing`deploy:update'**transaction:start*executing`deploy:update_code'*getting(viacheckout)revisionto/tmp/20111214204507executinglocally:cp-R./tmp/20111214204507commandfinishedin413mscompressing/tmp/20

ruby-on-rails - 带分号的字符串在 RubyMine 中产生 "unterminated string meets end of file"

在RubyMine调试器中,只需在watch中输入:';'或";"我收到错误:"unterminatedstringmeetsendoffile"这是为什么?据我所知,它不会发生在Rails控制台中,并且与RubyMine没有任何关系。 最佳答案 这是Ruby调试器与Ruby解释器具有不同解析规则的结果。事实上,从irb或ruby命令调用的常规Ruby调试器表现出相同的行为。然而,解决方法很简单:要创建一个由单个分号组成的字符串文字,只需使用反斜杠将其转义即可:$irb>require'debugger'=>true>debugge

ruby-on-rails - 将 Date 对象转换为 TimeWithZone

我需要将Date对象转换为TimeWithZone对象,表示给定时区中那一天的开始。以下方法可行,但似乎太复杂了,因为它需要我将日期转换为字符串:?>date=Date.parse("2010-02-17")=>Wed,17Feb2010>>ActiveSupport::TimeZone['EasternTime(US&Canada)'].parse(date.to_s)=>Wed,17Feb201000:00:00EST-05:00>>ActiveSupport::TimeZone['UTC'].parse(date.to_s)=>Wed,17Feb201000:00:00UTC00

ruby - "begin"和 "end"是不是保留字?

我对Ruby中的保留字有点困惑。Matz与人合着的《TheRubyProgrammingLanguage》说begin和end是语言的保留字。它们肯定在句法上用于标记block。但是,该语言中的范围对象具有名为begin和end的方法,如(1..10).end=>10现在,对此进行测试,我发现我确实可以在对象上定义名为“begin”和“end”的方法,但如果我尝试将变量命名为“begin”,它会失败。(这里有一个使用它作为方法名的示例,它确实有效......:)classFoodefbeginputs"hi"endendFoo.new.begin所以,我想我是在问,像这样的保留字的实际

ruby-on-rails - Rails 中的推杆 : "Unknown auth_key" - server side not triggering events

我正在尝试将Pusher插入到我已经很晚的Rails应用程序中。客户端工作正常-使用PusherEventCreator触发所需的javascript。但是服务器端不工作:在我的通知Controller中使用以下代码创建要测试的操作:Pusher.trigger('private-4','new_message',{:from=>"christian",:subject=>"hello"})给出这个错误:Pusher::AuthenticationError(Unknownauth_key):app/controllers/notifications_controller.rb:57:

ruby - Date::today 未定义?

为什么只有Date类的某些方法没有显式加载:require'date'线?例如:irb(main):002:0>Date.todayNoMethodError:undefinedmethod`today'forDate:Classfrom(irb):2from/Users/mwlang/.rvm/rubies/ruby-2.0.0-p0/bin/irb:16:in`'然后……irb(main):003:0>require'date'=>true导致...irb(main):004:0>Date.today=>#http://ruby-doc.org/stdlib-2.0/libdoc/

ruby - ruby Date.today 和 DateTime.now 的日期错误

我已经使用RVM安装了ruby​​-1.8.6-p383。系统ruby是1.9.1_p378-1我在使用ruby​​1.8时从Date.today和DateTime.now得到错误的日期。而Time.now是正确的:irb(main):002:0>DateTime.now.to_s=>"2126--1-10618T11:23:43+00:00"irb(main):004:0>Date.today.to_s=>"2126--1-10618"irb(main):005:0>Time.now=>ThuJan2811:55:27+00002010如果我切换到ruby​​1.9,一切都很好:ir

Ruby,从 Date.day_fraction_to_time 获取小时、秒和时间

我找到了这个方法here.start=DateTime.nowsleep15stop=DateTime.now#minutesputs((stop-start)*24*60).to_ihours,minutes,seconds,frac=Date.day_fraction_to_time(stop-start)我有以下错误:`':privatemethod`day_fraction_to_time'calledforDate:Class(NoMethodError)我检查了/usr/lib/ruby/1.9.1/date.rb并找到了它:defday_fraction_to_time(

ruby-on-rails - 嵌套模型、表单和 date_select FormHelper 集成

我关注了RyanBatestutorial在嵌套模型上。我的几个嵌套模型都有与之关联的日期。在我的迁移中,它们实际上是“Date”类型。我尝试过的一些事情和遇到的问题date_select-可以处理表单对象前缀,但不能处理嵌套模型属性select_year-不适用于表单对象通过使用(Time.now.year-100)..(Time.now.year)并覆盖attr访问器start_date和end_date以获取选择中的值以形成日期和传递回来。仅适用于创建,不适用于更新将字段的数据类型更改为字符串并使用使用(Time.now.year-100)..(Time.now.year)填充年

ruby - end.method 在 Ruby 中有什么作用?

我见过这样的代码:defsome_method#...end.another_methodend.another_method部分的作用是什么? 最佳答案 我相信你的例子是错误的,因为你在这里做的是定义一个方法并根据方法定义的结果调用一个方法(而不是方法调用),它总是(通常?)nil。fmendez指的是一种类似的形式,但end是block的结尾,在这种情况下不是方法定义。所以,例如:array.mapdo|element|element*elementend.sum假设会返回给定数组元素的平方和。但是,如果您像这样进行方法链接,则