A question about routing

Hi all,

I have recently bought a site template that I've tacked on to my rails
application. The template came with a flash movie that plays at the
top of each page, displaying the site's name and a few words of the
user's choosing. The template's files are stored in the /public
directory as follows:

/public/flash.txt #This is the text displayed in the flash movie
/public/picts/ # a directory where the templates pictures and gif
formatting files are stored
/public/flash/logo.fla
/public/logo.swf
/javascripts/header.js # This script launches the flash movie at the
top of a page

I am using the default routing for the rails application.

If I enter a URL in a browser that matches a controller and gives
no :action or :id parameters then the flash movie works just fine.
For instance: http://www.myapp.com/controller

If I enter anything more explicit than the above (i.e.
http://www.myapp.com/controller/index or http://myapp.com/controller/list/15)
then the movie will not play. On inspecting the errors in the
development log, I have the following:

Processing LoginController#picts (for 127.0.0.1 at 2007-09-05
16:52:13) [GET]
  Session ID: ed449af214e04296229e540d2ae277ae
  Parameters: {"format"=>"gif", "action"=>"picts", "id"=>"menu",
"controller"=>"login"}

ActionController::RoutingError (no route found to match "/login/
flash.txt" with {:method=>:get}):

I would appear that the flash movie is requesting files from the
server and that the server is not understanding the requests.

Can anyone point in in the right direction to solving this problem?

Many thanks for any help.
Jim

Jim Welch wrote:

Hi all,

I have recently bought a site template that I've tacked on to my rails
application. The template came with a flash movie that plays at the
top of each page, displaying the site's name and a few words of the
user's choosing. The template's files are stored in the /public
directory as follows:

/public/flash.txt #This is the text displayed in the flash movie
/public/picts/ # a directory where the templates pictures and gif
formatting files are stored
/public/flash/logo.fla
/public/logo.swf
/javascripts/header.js # This script launches the flash movie at the
top of a page

I am using the default routing for the rails application.

If I enter a URL in a browser that matches a controller and gives
no :action or :id parameters then the flash movie works just fine.
For instance: http://www.myapp.com/controller

If I enter anything more explicit than the above (i.e.
http://www.myapp.com/controller/index or http://myapp.com/controller/list/15)
then the movie will not play. On inspecting the errors in the
development log, I have the following:

Processing LoginController#picts (for 127.0.0.1 at 2007-09-05
16:52:13) [GET]
  Session ID: ed449af214e04296229e540d2ae277ae
  Parameters: {"format"=>"gif", "action"=>"picts", "id"=>"menu",
"controller"=>"login"}

ActionController::RoutingError (no route found to match "/login/
flash.txt" with {:method=>:get}):

I would appear that the flash movie is requesting files from the
server and that the server is not understanding the requests.

Can anyone point in in the right direction to solving this problem?

Many thanks for any help.
Jim

We need to see the part of your template where you are embedding the Flash object. I'm guessing you need to give an absolute path in there somewhere instead of a relative one.

Hi Michael,

Here is the line in my layout that calls the header javascript file:

<script language="JavaScript" type="text/javascript" src="/javascripts/
wheader.js"></script>

But I have aslo tried the following:

<%= javascript_include_tag "header" %>

which gives me exactly the same behaviour.

Here is the code in the header.js file, which is kept in /public/
javascripts/:

<!-- Begin HEADER OPTIONS CODE

// ONLY USE lowercase FOR ALL OPTIONS

// CHANGE ANY OF THESE VARIABLES TO "no" OR "yes" TO TURN AN OPTION
OFF OR ON

var color = "141424" // HEADER BACKGROUND COLOR
var flashheight = "50" // HEIGHT OF THE FLASH (IN PIXELS) (and
adjust the menu.js)
var flashwidth = "750" // WIDTH OF THE FLASH (IN PIXELS) (and adjust
the menu.js)
var stripes = "yes" // SHOW STRIPE UNDER THE FLASH
var stripeheight = "28" // HEIGHT OF THE STRIPE

// COPYRIGHT 2007 Allwebco Design Corporation
// Unauthorized use or sale of this script is strictly prohibited by
law

// YOU DO NOT NEED TO EDIT BELOW THIS LINE

document.write('<TABLE cellpadding="0" cellspacing="0" border="0"
width="100%" BGCOLOR="#'+color+'"><tr><td ALIGN="LEFT">');

document.write('<OBJECT classid="clsid:D27CDB6E-
AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/
pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
WIDTH="'+flashwidth+'" HEIGHT="'+flashheight+'" id="logo" ALIGN="">');
document.write('<PARAM NAME=movie VALUE="/logo.swf">');
document.write('<PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor
VALUE=#'+color+'>');
document.write('<EMBED src="/logo.swf" quality=high bgcolor=#'+color
+' WIDTH="'+flashwidth+'" HEIGHT="'+flashheight+'" NAME="logo"
ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://
www.macromedia.com/go/getflashplayer">');
document.write('</EMBED>');
document.write('</OBJECT><br>');

document.write('</td></tr></table>');

   if (stripes == "yes") {
document.write('<span class="printhide">');
document.write('<img src="/picts/stretchbar.jpg" width="100%"
height="'+stripeheight+'"><br>');
document.write('</span>');
}

// End -->

Please let me know if there is anything else that you would find
helpful in solving this problem.

Many thanks,
Jim