This one’s really got me scratching my head.
I’ve got a button_to_function (in application.rhtml) that opens a new window containing a file from the public directory. Or at least that’s what it’s supposed to do. It always launches a new window. Sometimes the file loads as expected. Sometimes the window launches that then I get an ActionController error (in the newly launched window) saying ‘no action responded’ to the file name.
I can reproduce the behavior, but have no idea why it’s behaving the way it is and would really appreciate it if someone could help me understand it.
I’ll post the code below. It’s not very interesting. What is interesting is this.
If the URL just calls the controller with no ‘/’ at the end, the new window is launched and the file opened in it. With the code below, if my URL is ‘http://localhost:3000/admin’ everything works.
Anybody? I sure would appreciate any help / explanation.
--------- controller ------------
class AdminController < ApplicationController
-------------- index.rhtml ---------------
<%= button_to_function “View/Print PDF”, “viewPDF()”, :class => ‘submit-btn’ %>
<%= flash[:notice] %>
<%= @content_for_layout %>