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 6864655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:56:19+00:00 2026-05-27T02:56:19+00:00

I have a Rails application with the backbone-rails gem. Which works out fine but

  • 0

I have a Rails application with the backbone-rails gem. Which works out fine but Backbone tries to send a request with all the attributes of the model. Is there a way I can filter out some of the attributes that will be POST’d on an update/new? This would work great for those virtual attributes and attributes that can’t be mass assigned.

  • 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-27T02:56:20+00:00Added an answer on May 27, 2026 at 2:56 am

    There is no harm in posting attributes that cannot be mass assigned. You will see a warning, but everything will work.

    There are basically two ways of actually removing unwanted attributes. The first is to customize the Model’s toJSON(). For example:

    myModel = Backbone.Model.extend({
      function: toJSON() {
        var json = _.clone(this.attributes);
        delete json.somethingIdontWant
        delete json.somethingElse
        return json
      }
    })
    

    The second, and less clean way, is to explicitly pass the data in your call to Model.save(). If you are using the default Backbone.sync() method, then this data will be used instead. For example:

    mything.save({
      data: {just: "the stuff", that: "i want to post"}
    })
    

    You can probably figure out a way to generalize either of those approaches, depending on which one works for you.

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

Sidebar

Related Questions

I have a rails application and I have all the jQuery scattered out in
I have a Rails application that works with mongodb. I want to deploy it
I have a Rails application that unfortunately after a request to a controller, has
I have a rails application which is running well in local (OsX, WEBrick). I've
I have Rails Application which uses JavaScript Extensively . I would like to know
I have a rails application what I want to send my users notifications when
I have a Rails application with several models-views-controllers which have some similar characteristics, for
I have a backbone application which, upon load, needs to fetch data from four
I have old rails application. And this application need the same gem with different
I have Rails application (Redmine) and I have created next working code which close

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.