为什么在YUI javascript中生成的链接无法在rails中呈现?
使用YAHOO.widget.treeview生成一个包含三个级别数据的表:模块,子模块和详细信息。如果有与细节行关联的图像,则javascript会生成链接:
"<td><a href="/screenshot/show/" + rowData.id + "">Screenshot</a></td>"
这是附加到行的html。
网址生成正确,并显示链接。单击时没有任何操作,除了浏览器状态栏中出现“完成”一词。
我从另一个不使用javascript的页面调用了相同的url,屏幕截图页面按预期显示。
这是控制器。
class ScreenshotController&lt; ApplicationController的
def show
if @ detail.screen_path.length> 1
@imagePath =“#{RAILS_ROOT}”+
“/private/#{Company.find(@detail.company_id).subdir}/”+
“#{Project.find(@ detail.project_id).subdir} / screenshot /”+
“#{@detail.screen_path}”
send_file(@imagePath,:type =>'image / jpeg',:disposition =>'inline')
结束
结束
结束
示例网址:http:// localhost:3004 / screenshot / show / 20854
属于详细模型的show.html.erb中的此代码有效:
查看',:controller =>'screenshot',:id => @ detail.id,:action =>'show'%>
有任何想法吗???
没有找到相关结果
已邀请:
1 个回复
括宠