jpmobile trans_sidが効かないとき
viewで
<%= link_to :hoge, {:action => :fuga} %>
なときは、
<a href="/xxx/fuga?_sid=098731246hdfa9s8hdf">hoge</a>
みたいになるけど
名前付きルートで
<%= link_to :hoge, fuga_path(@fuga) %>
とかのように、名前指定で引数を渡したときだけだと、
def link_to(name, options = {}, html_options = nil) url = case options when String options when :back @controller.request.env["HTTP_REFERER"] || 'javascript:history.back()' else self.url_for(options) end if html_options html_options = html_options.stringify_keys href = html_options['href'] convert_options_to_javascript!(html_options, url) tag_options = tag_options(html_options) else tag_options = nil end href_attr = "href=\"#{url}\"" unless href "<a #{href_attr}#{tag_options}>#{name || url}</a>" end escape ? escape_once(url) : url end
で、link_toに渡す第2引数がStringだと、
url_forにいかいので、trans_sid.rbの
protected # URLにsession_idを追加する。 def default_url_options(options) return unless request # for test process return unless apply_transit_sid? { session_key => session.session_id } end
がスカってしまう。
ので、session_idが付加されなかったみたい。
とりあえず
fuga_pathに引数つけないとちゃんと、渡すstringにsession_idが付加されてるから
大丈夫だった。
携帯で見るところは、Hashで渡す以前のやり方でやるか、引数渡さなくてもよいようにやるか。