[Rails] .rjs template doesn't load?

Tom Wilcoxen tomwilcoxen at gmail.com
Mon Feb 6 19:50:07 GMT 2006


Josh,

I have a similar requirement, but addressed it a little differently. I
don't know which is better. I set an instance variable in my
controller called @error and fill it with a message if the action
fails. Then in my .rjs I do:

if @error
  page.show 'ajax-error'
  page.replace_html 'ajax-error', @error
else
  page.hide 'ajax-error'
  page.replace_html 'my-div-name', :partial => 'mypartial'
  page.visual_effect :highlight, 'my-div-name', :duration => 1.5
end

-Tom


More information about the Rails mailing list