RJS issues in ym4r

Hi,

I am using the ym4r plugin, and have tried the traffic mash up example,
and everything there works great.

I then created a new rails project, and got this working with ym4r. My
problem is when I try to update the page using a .rjs file, it doesn’t
render properly. In my view, I have the following piece of code: <%=
form_remote_tag(:url => {:action => :save}) %>

Then in my controller, the save function is simply:
def save
@map = Variable.new(“map”)
end
Within ym4r, this simply assigns the javascript variable map (my GMap2
element) to the ruby var @map.

I then have this simple save.rjs file:
page << @map.clear_overlays
This should just clear the overlays that I have added to the map from
it. Pretty straight forward.

However, when I click on the button that submits the form to the save
action, I receive this in my browser:
try {
map.clearOverlays();
} catch (e) { alert(‘RJS error:\n\n’ + e.toString());
alert(‘map.clearOverlays();’); throw e }

It seems like the javascript that is created is simply being output,
instead of actually being run. The other thing I noticed is that after
I click the button that calls the save function, my url becomes
http://localhost:3000/map/save, and not just http://localhost:3000/map
as I expect. In the traffic mash up example for ym4r, when the find
function is called, it is never appended to the end of the url as is
happening in my case.

I am including the default AJAX libraries ( <%= javascript_include_tag
:defaults %>).

Does anybody have any ideas as to what might be happening?

Thanks,

Simon

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs