I have an HTML MAP over laying some video so i can control aPTZ camera
through my server code. The camera is not visible outside the network
so i want to control access to it.
The above code is generate by some ruby code in the model area.rb
models/area.rb
def createArea()
for a in @areas
line = "<area shape=\"#{a.shape}\" coords=
“#{a.x},#{a.y},#{a.x2},#{a.y2}”
onclick=“new Ajax.Request(’/page/
moveCamera_#{a.command}?ip=#{ip}’, {asynchronous:true,
evalScripts:true})” > "
lines[i] = line
i = i + 1
end
…
end
The above code worked just fine. But with the new token_tag stuff it
won’t work and I don’t have a clue how to make it work.
My question is where to I put the the “token_tag” stuff to create the
token so Rails won’t reject the request? I generate the code within
the area.rb so the model has control over the data it gets from the
database.
I really don’t want to create new “rails” functions or override stuff
that will get outdated in the next Rails release. I just want to know
how to fix my Ajax.Request() line so my code will work again.
I know it has something to do with “:url =>
token_tag_nightmare_additons” in Ajax.Request or i need to create
remote_function with it. But this code works and if I remember
correctly it was hard enough to get it work the first time.
(Please just help. And try to be specific as you can. Hand waving does
not actually help nor does a lecture on why dont I do it the the
“Rails Form way”. As of this point I am so fustrated with the
2.0.death Rails release that I feel like dumping my 2 years worth of
work in ROR and rewritting it in PHP.)
((Yes, i have every imaginable book on ROR in my library here, so if
you can cite a specific page in a Book that would be great too.))
And yes, i do have it working with the old code by turning off the
securty
skip_before_filter :verify_authenticity_token