YAHOO.widget.treeview を使用して、モジュール、サブモジュール、および詳細の 3 つのレベルのデータを含むテーブルを生成します。詳細行に関連付けられた画像がある場合、javascript はリンクを生成します。
"<td><a href=\"/screenshot/show/" + rowData.id + "\">Screenshot</a></td>"
行の html に追加されます。
URL が正しく生成され、リンクが表示されます。クリックしても何も起こらず、ブラウザのステータス バーに「完了」という単語が表示されます。
JavaScript を使用しない別のページからまったく同じ URL を呼び出すと、スクリーンショット ページが期待どおりに表示されます。
こちらがコントローラー。
class ScreenshotController < 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') end
end終わり
サンプル URL: http://localhost:3004/screenshot/show/20854
詳細モデルに属する show.html.erb のこのコードは機能します。
View', :controller => 'screenshot', :id => @detail.id, :action => 'show' %>何か案は???