I’m trying to implement something similar to the “multiple updates”
section
of the Web2.0 chapter of the Agile book.
I implemented my version, and nothing is happening. No javascript
errors,
my logs look fine, page is rendered fine… just no Effect.Highlight.
Here
is the code:
<% 3.times do |i| %>
new Effect.Highlight(‘div<%= i %>’);
<% end %>
controllers/causes/cause_home_controller.rb
def update @cause = Cause.find(@params[:id])
if !@cause.update_attributes(@params[:cause])
flash[:notice] = “Data was not updated”
end
render(:template => “causes/cause_home/update”)
end
My layout has all the proper javascripts being included.
I did a “new Effect.Highlight” on a test
within the
index.rhtmlpage, and it worked fine.
So, I’m at a loss as to how and debug further. Is there some other
things I
can check ?
You do not have a div with id=“div0”
I am assuming that this is causing a javascript error and the rest of
the code is not being evaluated;
Try
<% 3.times do |i| %> new Effect.Highlight(‘div<%= i+1 %>’);
No, I was just trying to supress a newline before the
closing quote. But that’s not the OP’s problem because
I keep forgetting that the newline supressing tag is only
needed when it appears at the end of a line.
–
We develop, watch us RoR, in numbers too big to ignore.
Jules, unfortunately, it didn’t work. I’m scared of using edge rails…
but
I may have to try it out I guess.
Henry, thanks for that piece… I didn’t know about remote_function()
Did the response from the alert() look correct ? It just shoves in the
raw
javascript calls like that ?
That nailed it on the head. When I first saw what was being rendered
via
the alert, I was suspicious… but didn’t quite get what was happening.
Mark, excellent controller code.