Questions tagged «ruby-on-rails-2»

11
Rails ActiveRecord日期之间
我需要查询一天内发表的评论。该字段是标准时间戳记的一部分created_at。所选日期来自date_select。 我ActiveRecord该怎么做呢? 我需要类似的东西: "SELECT * FROM comments WHERE created_at BETWEEN '2010-02-03 00:00:00' AND '2010-02-03 23:59:59'"

4
Gem:Module的未定义方法`source_index'(NoMethodError)
我正在运行Rails 2.3.5应用程序,并且在运行脚本/服务器时显示以下内容: ./script/../config/../vendor/rails/railties/lib/rails/gem_dependency.rb:21:in `add_frozen_gem_path': undefined method `source_index' for Gem:Module (NoMethodError) from ./script/../config/boot.rb:60:in `load_initializer' from ./script/../config/boot.rb:44:in `run' from ./script/../config/boot.rb:17:in `boot!' from ./script/../config/boot.rb:123 from script/server:2:in `require' from script/server:2 如果我在boot.rb(Rails :: GemDependency.add_frozen_gem_path)中注释掉第60行并运行脚本/服务器,则会得到以下信息: => Booting WEBrick => Rails 2.3.5 application starting on http://0.0.0.0:3000 ./script/../config/../vendor/rails/railties/lib/rails/gem_dependency.rb:21:in `add_frozen_gem_path': undefined method `source_index' for Gem:Module (NoMethodError) from ./script/../config/../vendor/rails/railties/lib/initializer.rb:298:in `add_gem_load_paths' …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.