У меня есть небольшое приложение для рельсов, которое я получил сегодня вечером, желая преобразовать все шаблоны erb в haml Документы Haml предлагают запустить haml --rails /path/to/app
, чтобы установить его как плагин (используя гем, уже установленный в системе).
К сожалению, когда я пытаюсь запустить веб-сервер для рельсов, я получаю следующую ошибку:
/code/src/myapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:443:in `load_missing_constant': uninitialized constant Haml (NameError)
from /code/src/myapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:80:in `const_missing'
from /code/src/myapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:92:in `const_missing'
from /code/src/myapp/config/environment.rb:15
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:111:in `run'
from /code/src/myapp/config/environment.rb:5
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from /code/src/myapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
from /code/src/myapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /code/src/myapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
from /code/src/myapp/vendor/rails/railties/lib/commands/server.rb:84
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from ./script/server:3
Это раздражает строку в моем файле окружения:
# Be sure to restart your server when you modify this file
RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
require File.join(File.dirname(__FILE__), 'boot')
Rails::Initializer.run do |config|
# Add additional load paths for your own custom dirs
config.load_paths += %W(
#{RAILS_ROOT}/lib/
)
# Specify gems that this application depends on and have them installed with rake gems:install
config.gem 'twitter'
config.gem 'newrelic_rpm'
Haml::Template.options[:format] = :html5
Haml::Template.options[:attr_wrapper] = '"'
config.plugins = [ :all ]
config.active_record.observers = :user_observer
config.time_zone = 'UTC' # "rake -D time" for all time zone names.
end
ConsumerConfig = YAML.load(File.read(Rails.root + 'config' + 'twitter-auth.yml'))
Ошибка в строке, пытающейся установить некоторые параметры Haml (Haml::Template.options[:format] = :html5
). Установка плагина haml с script/plugin install
приводит к той же ошибке, что и require haml
в верхней части environment.rb. Не уверен, что это имеет значение, но рельсы заморожены в vendor/rails
.
Это очень смущает меня, пожалуйста, помогите, если вы можете понять это.