Newbie question about "render :update do |page|"

Hi Railies

I’m somewhat stuck trying to add some AJAX to my app, AJAX newbie stuff
I guess:


<%= link_to_remote 'GO', :update => 'ajax_form', :url => { :action => 'test' } %>

def test
render :update do |page|
page.replace_html ‘ajax_list’, ‘just testing’
page.replace_html ‘ajax_form’, ‘here too’

When I hit the GO link, I get this output dumped in the ajax_form-div:

NoMethodError in CompanyController#test
undefined method +' for #<Mime::Type:0x25cc57c> #{RAILS_ROOT}/app/controllers/application.rb:164:inset_charset’

My code does look wrong to me, too, with ajax_form appearing in both
link_to_remote and replace_html. But I don’t seem to be able to figure
out the right way to do it.

Big thanks for your help!!

Fixed it, an application helper that altered headers caused the issue.

Not sure if this was part of the fix or not, but don’t mix the use of
the :update option in the remote call with a render :update. You’ll
end up with js rendered into your target element.

On Aug 21, 6:00 am, Sven S. [email protected]

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