I am testing a local copy of my website using Mongrel trying to
introduce a scriptaculous multi-level drop down menu. the menu is a
partial that is loaded into every layout I have many pages with their
individual layout file. When I jump from page to page(index to index)
all works OK. When I
jump from any "view/index" to "view/show" I lose the javascript and
the
drop down menu only works on the first level. Can anyone shed some
light
on why this happens and how I can solve it. In my layouts heads I have
the following:-
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>Blogpictures: <%= controller.action_name %></title>
<%= stylesheet_link_tag 'style' %>
<script src="javascripts/scriptaculous.js"
type="text/javascript"></script>
<script type='text/javascript' src='javascripts/menu.js'></script>
</head>
In the source html both index and show has exactly the same head
(except title)
I am using the control.js protype.js etc that came with the
scriptaculous download also using the latest versions of Ruby, Rails,
Gems etc
Gems etc.
I am testing a local copy of my website using Mongrel trying to
introduce a scriptaculous multi-level drop down menu. the menu is a
partial that is loaded into every layout I have many pages with their
individual layout file. When I jump from page to page(index to index)
all works OK. When I
jump from any "view/index" to "view/show" I lose the javascript and
the
drop down menu only works on the first level. Can anyone shed some
light
on why this happens and how I can solve it. In my layouts heads I have
the following:-
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>Blogpictures: <%= controller.action_name %></title>
<%= stylesheet_link_tag 'style' %>
Those are relative paths, and almost certainly only work from the root
of your site. It greatly helps when developing to use a tool like
Firebug which will show you that the javascript files are 404ing.
And is there a reason you're not using javascript_include_tag?
"Thanks for that I am not an expert Ruby on Rails programmer. I
suspect that the "show" is relative to the "index" and the index is
relative to the root. I will go and read up on
Javascript_include_tag. I do use firebug and oops! yes it is flagging
a 404 error. now to solve it.
Thanks for the above javascript_include_tag solved the problem.
I should learn to use Ruby all the time instead of a mixture of ruby
and HTML.
Thanks againThanks for the above javascript_include_tag solved the
problem.
I should learn to use Ruby all the time instead of a mixture of ruby
and HTML.
Thanks again