启动rails应用程序的难度

时间:2011-05-04 11:47:13

标签: ruby-on-rails ruby rake haml

我正在尝试运行Rails应用程序,但我得到以下输出:

ruby script/server 
=> Booting Mongrel
=> Rails 2.3.4 application starting on http://0.0.0.0:3000
/home/umar/.rvm/gems/ruby-1.8.6-head/gems/rails-2.3.4/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010.  Use #requirement
/home/umar/.rvm/gems/ruby-1.8.6-head/gems/haml-2.0.0/lib/haml/helpers/action_view_mods.rb:46:in `alias_method': undefined method `capture_erb_with_buffer' for module `ActionView::Helpers::CaptureHelper' (NameError)
    from /home/umar/.rvm/gems/ruby-1.8.6-head/gems/haml-2.0.0/lib/haml/helpers/action_view_mods.rb:46
    from /home/umar/.rvm/rubies/ruby-1.8.6-head/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /home/umar/.rvm/rubies/ruby-1.8.6-head/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from /home/umar/.rvm/gems/ruby-1.8.6-head/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require'
    from /home/umar/.rvm/gems/ruby-1.8.6-head/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /home/umar/.rvm/gems/ruby-1.8.6-head/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require'
    from /home/umar/.rvm/gems/ruby-1.8.6-head/gems/haml-2.0.0/lib/haml/helpers.rb:1
    from /home/umar/.rvm/rubies/ruby-1.8.6-head/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
     ... 34 levels...
    from /home/umar/.rvm/gems/ruby-1.8.6-head/gems/rails-2.3.4/lib/commands/server.rb:84
    from /home/umar/.rvm/rubies/ruby-1.8.6-head/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /home/umar/.rvm/rubies/ruby-1.8.6-head/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from script/server:3

以下是我的gem list命令的输出:

gem list

*** LOCAL GEMS ***

actionmailer (2.3.4)
actionpack (2.3.4)
activerecord (2.3.4)
activerecord-jdbc-adapter (1.1.1)
activerecord-jdbcmysql-adapter (1.1.1)
activeresource (2.3.4)
activesupport (2.3.4)
builder (3.0.0)
cgi_multipart_eof_fix (2.5.0)
daemons (1.1.3)
fastthread (1.0.7)
gem_plugin (0.2.3)
haml (2.0.0)
jdbc-mysql (5.1.13)
mongrel (1.1.5)
rack (1.0.1)
rails (2.3.4)
rake (0.8.7)
rspec (1.3.1)
rspec-rails (1.3.3)
will_paginate (2.2.2)

我的宝石-v是1.3.7

如何解决此错误?

1 个答案:

答案 0 :(得分:1)

使用旧版本的haml肯定是个问题。 Haml 2.0使用了这种方法capture_erb_with_buffer,这种方法在超出2.1.0的Rails版本中不存在。

http://apidock.com/rails/ActionView/Helpers/CaptureHelper/capture_erb_with_buffer

确保在安装正确的gem之后使用项目根目录中的haml --rails命令进行升级和安装。