Using YAHOO.widget.treeview to generate a table with three levels of data: module, submodule, and detail. If there is an image associated with a detail row the javascript generates a link:
"<td><a href=\"/screenshot/show/" + rowData.id + "\">Screenshot</a></td>"
that is appended to the html for the row.
The url is generated correctly and the link appears. When clicked nothing happens except the word 'Done' appears in the browser status bar.
Am calling the very same url from another page that does not use javascript and the screenshot page appears as expected.
Here is the controller.
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
end
A sample url: http://localhost:3004/screenshot/show/20854
This code from show.html.erb belonging to the detail model works: <%= link_to 'View', :controller => 'screenshot', :id => @detail.id, :action => 'show' %>
Any ideas???