title: Can iOS devices send PUT requests to Rails apps?
body: <p>We've tried numerous times sending update PUT requests to our Rails server and we keep receiving a 404 "The page you were looking for does not exist"</p>
  
  <p>Our update method is very simple (practically generic rails).</p>
  
  <pre><code>def update
  @user = User.find(params[:id])
  
  respond_to do |format|
    if @user.update_attributes(params[:user])
      format.html { redirect_to @user, notice: 'User was successfully updated.' }
      format.json { head :no_content }
    else
      format.html { render action: "edit" }
      format.json { render json: @user.errors, status: :unprocessable_entity }
    end
  end
  </code></pre>
  
  <p>end</p>
  
  <p>When I run CURL from the command line to test the update method, it works fine. But, when I try the same methods in objective-c, it always results in a 404 error.</p>
  
  <p>So my question is: can iOS devices send PUT requests to servers using NSURLConnection or is this not implemented?</p>
  
  <p>UPDATE::</p>
  
  <p><strong>This doesn't update the database</strong></p>
  
  <pre><code>NSString *dataString = @"user[first_name]=bob";
  NSData *postBodyData = [NSData dataWithBytes: [dataString UTF8String] length:[dataString length]];
  NSString *urlString = [NSString stringWithFormat:@"example.com/users/1.json"];
  NSURL *fullURL = [NSURL URLWithString:urlString];
  NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:fullURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:20];
  [request setHTTPMethod: @"PUT"];
  [request setHTTPBody:postBodyData];
  self.todoConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
  receivedData = [NSMutableData data];
  </code></pre>
  
  <p><strong>This updates the database</strong></p>
  
  <pre><code>NSString *urlString = [NSString stringWithFormat:@"example.com/users/1.json?user[first_name]=bob"];
  NSURL *fullURL = [NSURL URLWithString:urlString];
  NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:fullURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:20];
  [request setHTTPMethod: @"PUT"];
  self.todoConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
  receivedData = [NSMutableData data];
  </code></pre>