jpmobile/jpmobile — Issue #40: render partialにてmobileテンプレートが採用されない
Author: pacojp
Created: 2012-02-24 10:45:55+00:00
State: open

<%=render :partial=>'shared/test'%>
上記の記法だと問題なくapp/views/shared/_test_mobile.html.erbが使用されます。

<%=render :partial=>'/shared/test'%>
上記の記法だと（パスの指定の頭に"/"が追加）app/views/shared/_test.html.erbが使用されてしまいます。

resolver.rbの16行目に出力を仕掛けたところ以下な出力になりました。

<%=render :partial=>'/shared/test'%>の場合
==============================
"/Users/hoge/test/jpmobile_test/app/views/welcome/index{_{},}{.{en},}{.{html,text,js,css,ics,csv,png,jpeg,gif,bmp,tiff,mpeg,xml,rss,atom,yaml,multipart_form,url_encoded_form,json,pdf,zip},}{.{erb,builder,coffee},}"
==============================
"/Users/hoge/test/jpmobile_test/app/views/welcome/index{_{mobile_docomo,mobile},}{.{en},}{.{html},}{.{erb,builder,coffee},}"
==============================
"/Users/hoge/test/jpmobile_test/app/views/layouts/welcome{_{mobile_docomo,mobile},}{.{en},}{.{html},}{.{erb,builder,coffee},}"
==============================
"/Users/hoge/test/jpmobile_test/app/views/layouts/application{_{mobile_docomo,mobile},}{.{en},}{.{html},}{.{erb,builder,coffee},}"
==============================
"/shared/_test{_{mobile_docomo,mobile},}{.{en},}{.{html},}{.{erb,builder,coffee},}"

<%=render :partial=>'shared/test'%>の場合
==============================
"/Users/hoge/test/jpmobile_test/app/views/welcome/index{_{},}{.{en},}{.{html,text,js,css,ics,csv,png,jpeg,gif,bmp,tiff,mpeg,xml,rss,atom,yaml,multipart_form,url_encoded_form,json,pdf,zip},}{.{erb,builder,coffee},}"
==============================
"/Users/hoge/test/jpmobile_test/app/views/welcome/index{_{mobile_docomo,mobile},}{.{en},}{.{html},}{.{erb,builder,coffee},}"
==============================
"/Users/hoge/test/jpmobile_test/app/views/layouts/welcome{_{mobile_docomo,mobile},}{.{en},}{.{html},}{.{erb,builder,coffee},}"
==============================
"/Users/hoge/test/jpmobile_test/app/views/layouts/application{_{mobile_docomo,mobile},}{.{en},}{.{html},}{.{erb,builder,coffee},}"
==============================
"/Users/hoge/test/jpmobile_test/app/views/shared/_test{_{mobile_docomo,mobile},}{.{en},}{.{html},}{.{erb,builder,coffee},}"

以前は、ともに問題なく_test_mobile.html.erbが使用されたと記憶してますがちょっと怪しいです。
rails的にはどちらの記法でも動作するので修正していただけるとうれしいです。

再現環境はRails3.2になります。