开发者

RAILS-3.1 render method for ActionView::Base

I have the problem with rails-3.1:

rails c
Loading development environment (Rails 3.1.0.rc5)
ree-1.8.7-2011.03 :001 > v=ActionView::Base.new
ree-1.8.7-2011.03 :002 > v.render :partial => 'shared/test'
ActionView::MissingTemplate: Missing partial shared/test with {:formats=>[:html, :text, :js, :css, :ics, :csv, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json], :locale=>[:en, :en], :handlers=>[:erb, :builder]}. Searched in:

    from /home/alex/.rvm/gems/ree-1.8.7-2011.03@main/gems/actionpack-3.1.0.rc5/lib/action_view/path_set.rb:14:in `find'
    from /home/alex/.rvm/gems/ree-1.8.7-2011.03@main/gems/actionpack-3.1.0.rc5/lib/action_view/lookup_context.rb:85:in `find_template'
    from /home/alex/.rvm/gems/ree-1.8.7-2011.03@main/gems/actionpack-3.1.0.rc5/lib/action_view/renderer/partial_renderer.rb:322:in `find_template'
    from /home/alex/.rvm/gems/ree-1.8.7-2011.03@main/gems/actionpack-3.1.0.rc5/lib/action_view/renderer/partial_renderer.rb:316:in `find_partial'
    from /home/alex/.rvm/gems/ree-1.8.7-2011.03@main/gems/actionpack-3.1.0.rc5/lib/action_view/renderer/partial_renderer.rb:220:in `render'
    from /home/alex/.rvm/gems/ree-1.8.7-2011.03@main/gems/actionpack-3.1.0.rc5/lib/action_view/renderer/abstract_renderer.rb:22:in `wrap_formats'
    from /home/alex/.rvm/gems/ree-1.8.7-2011.03@main/gems/actionpack-3.1.0.rc5/lib/action_view/renderer/partial_renderer.rb:219:in `render'
    from /home/alex/.rvm/gems/ree-1.8.7-2011.03@main/gems/actionpack-3.1.0.rc5/lib/action_view/renderer/renderer.rb:41:in `render_partial'
    from /home/alex/.rvm/gems/ree-1.8.7-2011.03@main/gems/actionpack-3.1.0.rc5/lib/开发者_运维百科action_view/renderer/renderer.rb:15:in `render'
    from /home/alex/.rvm/gems/ree-1.8.7-2011.03@main/gems/actionpack-3.1.0.rc5/lib/action_view/helpers/rendering_helper.rb:24:in `render'

Why?

In rails-3.0.9 it works

Thanks


Are you using plain .erb or .haml (or another builder?) to create your views? Are you 100% sure it is the right path as well? Or maybe updating to 3.1 (now that it was released) solved your issue??

Anyways, I know it's an "old" question but even if you're not longer having this issue, others might be :)


This happens if your files have a .rhtml extension and you're upgrading from 3.0 to 3.1. If you rename all the .rhtml files to .html.erb it should work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜