Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7440699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:53:34+00:00 2026-05-29T10:53:34+00:00

I am trying to add a file to a model using qqfile (though that

  • 0

I am trying to add a file to a model using qqfile (though that really isn’t relevant here).

I look at the params being passed to the server for update, and I have

{ id: 63, photo: 'foto_file.jpg'}

My understanding was that if an object was passed with an id parameter, rails would understand that as an already existing object, and update that model. If no id parameter is present, Rails would use create.

Is that not correct?? How in this instance can I tell rails to update rather than create?
I’m assuming more code isn’t needed here, as my controllers won’t really help with the solution because I think the decision is made by rails before it really hits the controller. But I’m happy to post the controller code if it is needed.

————— my javascript used to update or create the model ———————

render: function(){
        var start_form=HandlebarsTemplates['user/userForm'](user.attributes);
        $(this.el).html(start_form);

        var uploader = new qq.FileUploader({
            element: document.getElementById('file-upload'),
            action: '/users',
            onSubmit: function(id, fileName){

                if(MyApp.user.id){
                 uploader.setParams({
                    id: MyApp.user.id
                    });
                }
            },
            debug: true
        });


    },
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:53:35+00:00Added an answer on May 29, 2026 at 10:53 am

    The update method is only used when you sent a PUT request, not a POST request. Make sure you’re using the PUT method. (If you show your form’s code, I can give a more specific answer).

    Update — With your code, try adding this as a parameter to your qq.FileUploader call:

    params: {
      _method: "put"
    }
    

    Rails will look for a _method parameter to handle PUT/DELETE requests.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to add .css and .js file in my HTML template files that
I am trying to read a Resource file in VSTO Shared add-in using the
Im trying to add some short file names to a Wise installer to fix
I'm trying to add an header file to dev-C++ but when I compile it
I'm trying to add the iTunesArtwork file to my iPhone application in order to
I'm trying to add a publisher policy file to the gac as per this
I am trying to add a virtual directory to my web config file so
I've encountered this problem (while trying to add SQL Server Database (.mdf) file to
I am reading in numbers from a file and then trying to add them
I'm trying to extend a form and add an upload file field from within

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.