Hi

I'm trying to automaticly update data using a ajax call out of jquery.
When an object gets moved, this code is being executed: 

 

This is my jquery code

$.ajax({
      type: "PUT",
      url: "/devices/2328.xml",
    data: '<device><name>test</name></device>',
      
      contentType: 'application/xml', // format of request payload
      dataType: 'html', // format of the response
      }); 

My controller looks like this:

  def update
    @device = Device.find(params[:id])
    if @device.update_attributes(device_params)
      respond_with @device
    else
      render :action => 'edit'
    end
  end
 private
    def device_params
      params.require(:device).permit(:name)
    end

In my log I can see the request comming in, but nothing really happens, see 
at the bottom *Completed 204 No Content*
I'm also noticing that the value that I'm passing cannot be found at the 
parameters part of the log
 

Started PUT "/devices/2328.xml" for 127.0.0.1 at 2014-02-01 19:10:33 
+0100Processing by DevicesController#update as XML
  Parameters: {"id"=>"2328"}

  Device Load (0.4ms)  SELECT `devices`.* FROM `devices` WHERE `devices`.`id` = 
2328 LIMIT 1
   (0.1ms)  BEGIN
   (0.1ms)  COMMITCompleted 204 No Content in 9ms (ActiveRecord: 0.6ms)

I can't really figure out what is wrong.

Does anyone have a clue?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/161afd6a-d036-4b20-9dba-a63e6c564604%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to