我想支持vanity_urls,目前正在使用重定向工作正常,但宁愿只调用控制器/动作/参数,如注释部分所示:
class VanityUrlController < ApplicationController
def index
item=VanityUrl.where('url=?',params[:url]).first
if item.urlable_type=='Location'
location=Location.find(item.urlable_id)
redirect_to location_show_path(item.urlable_id)
# would like something like this
#call controller_name: locations, action: show, params: {id: item.urlable_id}
end
end
这可能吗?谷歌搜索给了我一堆重定向sol'ns但宁愿不重定向。怎么会这样做?
THX