The problem is that the image remains the same! The functionality of
what is occuring in the the controller action, channel.freezer, is
correct, but the link_to_remote never rerenders UNLESS I refresh the
page. Can somene tell me why this is and how I can fix it so that my
page renders properly? Thanks, Janna B.
def freezer
if @channel.floorfrozen == 0
@channel.update_attributes(:floorfrozen => 1)
@channel.floorfrozen = 1
else
@channel.update_attributes(:floorfrozen => 0)
@channel.floorfrozen = 0
end
render :action => 'display'
end
I'm stumped here -- well aware that link_to_remote is intended to do
something other than what I am trying to use it for. You see, I need
to create a sort of button, that takes an image and that has different
looks (css styles, depending upon the state of a variable), that works
without rendering a page.
God. Does anyone know any way I can accomplish this? It SEEMS like it
is easiest solved as a rails solution because of the Ajax helpers
inherint in Rails -- but I am open to anything! -Janna B
I'm stumped here -- well aware that link_to_remote is intended to do
something other than what I am trying to use it for. You see, I need
to create a sort of button, that takes an image and that has different
looks (css styles, depending upon the state of a variable), that works
without rendering a page.
Well you're calling render in your action but you haven't told
link_to_remote what it should do with the html that is rendered so it
just dumps it on the floor. (Have a look at link_to_remote's :update
option)
....continuing, the point is, it does NOT rerender that partial / div
even though the controller code is being executed properly. Isn;t this
the way I should do something though for link_to_remote when what I
want to update contains the html portion that calls it? -Janna B
You've put the update in the hash of url options, which you shouldn't
do.
It should be link_to_remote 'blah', {:url => {...}, :update =>
"..."}, html_options
You know....your sharing of your knowledge on here...I can read all
day long on Ruby, and I can write code all day long -- but when you
(and a few others on this list as well) point out what should be
obvious (errors) to me, it REALLY sinks in, and my understanding of
this grows exponentially, and I am obligated in the future to
contribute to others questions as my knowledge level increases.
I really cannot thank you -- and the others here who help, enough. -
Janna B