Rails 3未加载HAML处理程序 [英] Rails 3 not loading HAML handler

查看:57
本文介绍了Rails 3未加载HAML处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序中出现了Rails 3和HAML的问题:出于某种原因,Rails似乎没有加载用于处理haml文件的处理程序.每个动作都会给出与此错误消息类似的错误消息:

I'm having some problems with Rails 3 and HAML in my application: for some reason Rails appears not to be loading the handler for dealing with haml files. Every action gives an error message similar to this one:

缺少带有{:formats => [:html] 、: handlers => [:rjs,:rhtml,:rxml,:builder,:erb] 、: locale => [:en,:en ]}在视图路径"/var/www/osphonebook/app/views"、/var/www/osphonebook/vendor/bundle/ruby/1.8/gems/devise-1.3.4/app/views"中

Missing template contact_search/index with {:formats=>[:html], :handlers=>[:rjs, :rhtml, :rxml, :builder, :erb], :locale=>[:en, :en]} in view paths "/var/www/osphonebook/app/views", "/var/www/osphonebook/vendor/bundle/ruby/1.8/gems/devise-1.3.4/app/views"

查看处理程序"选项:它没有:haml ...

Look at the "handlers" options: it does not have :haml...

问题是,这仅在我公司设置的服务器上的生产模式下发生.在开发和测试模式下,它可以正常工作.另外,如果我在开发PC上以生产模式启动该应用程序,则它可以正常工作.

The thing is that this only happens during production mode on the server set up by my company. On development and test modes it works fine. Also, if I start the application in production mode on my development PC, it works.

有关服务器的一些信息:

Some info about the server:

更新(6/6/2011):已升级到Ruby 1.9 ,但仍然无法正常工作.

UPDATE (6/6/2011): upgraded to Ruby 1.9, and it still does not work.

ruby 1.9.2p0 (2010-08-18 revision 29036) [i486-linux]

Gems included by the bundle:
abstract (1.0.0)
actionmailer (3.0.7)
actionpack (3.0.7)
activemodel (3.0.7)
activerecord (3.0.7)
activeresource (3.0.7)
activesupport (3.0.7)
arel (2.0.10)
bcrypt-ruby (2.1.4)
builder (2.1.2)
bundler (1.0.14)
devise (1.3.4)
erubis (2.6.6)
haml (3.1.1)
i18n (0.5.0)
kgio (2.4.1)
mail (2.2.19)
mime-types (1.16)
orm_adapter (0.0.5)
pg (0.11.0)
polyglot (0.3.1)
rack (1.2.3)
rack-mount (0.6.14)
rack-test (0.5.7)
rails (3.0.7)
railties (3.0.7)
rake (0.8.7)
sass (3.1.2)
sqlite3 (1.3.3)
thor (0.14.6)
treetop (1.4.9)
tzinfo (0.3.27)
unicorn (3.6.2)
warden (1.0.4)

如果需要更多信息,请评论该问题,我将对其进行更新.感谢您的帮助.

If more info is needed, please comment the question, and I'll update it. Thanks for any help.

推荐答案

我发现了问题:我已经更改了config/environments/production.rb文件,为ActionMailer设置了一些个性化代码.事实是,我直接使用了该类,就像这样:

I've found the problem: I had changed the config/environments/production.rb file to set some personalized code for the ActionMailer. The thing is that I was using the class directly, like this:

ActionMailer::Base.delivery_method = :sendmail
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.charset = "utf-8"

而不是这样:

config.action_mailer.delivery_method = :sendmail
config.action_mailer.raise_delivery_errors = true
config.action_mailer.charset = "utf-8"

使用ActionMailer类似乎会直接触发ActionView加载程序,并设置所有内部变量,从而阻止HAML代码自行安装.

It appears that using the ActionMailer class directly fired the ActionView loaders, and set all the internal variables, preventing the HAML code to install itself.

更改代码后,它就像一个魅力.

After changing the code it worked like a charm.

这篇关于Rails 3未加载HAML处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆