升级到Rails 3.1.0后,带有atom_feed的ActionView :: Template :: Error(错误的参数数量(1表示0)) [英] ActionView::Template::Error (wrong number of arguments (1 for 0)) with atom_feed after upgrading to rails 3.1.0
问题描述
我刚刚将Rails应用程序从3.0.7版本升级到了候选发布版本3.1.0,我在原子供稿生成器中遇到了一个奇怪的错误:
I've just upgrade my rails application from the 3.0.7 version to the release candidate 3.1.0 and I got a strange error located in my atom feed builder:
ActionView::Template::Error (wrong number of arguments (1 for 0)):
1: atom_feed do |feed|
2: feed.title("site name")
3:
4: for post in @posts
app/views/posts/index.atom.builder:1:in `_app_views_posts_index_atom_builder___1517323884_2197638100'
在atom_feed
方法中似乎需要一个参数,但是我尝试在其中添加一些内容,但并没有解决问题.在升级之前就可以了.
It seems to need an argument in the atom_feed
method, but I tried to put something in it and it hasn't fixed the problem. It worked before the upgrade.
推荐答案
Builder 3.0与ruby 1.8.7上的fast_xs 0.8.0不兼容,并且会出现此错误.也许您已经安装了该软件? (还请注意,Hpricot捆绑了fast_xs 0.8.0)
Builder 3.0 is not compatible with fast_xs 0.8.0 on ruby 1.8.7 and will give this error. Perhaps you have that installed? (also note that Hpricot bundles fast_xs 0.8.0)
(edit :)您可以通过将其拖放到配置目录中来进行猴子修补:
(edit:) you can monkey patch it by dropping this in your config dir:
class String
def fast_xs_absorb_args(*args); fast_xs; end
alias_method :to_xs, :fast_xs_absorb_args
end
这篇关于升级到Rails 3.1.0后,带有atom_feed的ActionView :: Template :: Error(错误的参数数量(1表示0))的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!