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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:37:28+00:00 2026-05-31T21:37:28+00:00

I am using backbone and trying to create a new object and I am

  • 0

I am using backbone and trying to create a new object and I am running into this error. I thought rails would just ignore attributes that it doesn’t care about. i.e. the authenticity token isnt trying to be added to my object.

My controller:

def create
  page = Page.find(params[:page_id])
  branch = page.page_branches.build(params[:page_branch])
  branch.form = page.form
  if branch.valid?
    page.page_branches << branch
    redirect_to(edit_page_path(page, :anchor => "branch-panel"))
  else
    raise "#{branch.errors.map}"
  end
end

The Error:

Processing by PageBranchesController#create as JSON
Parameters: {"page_branch"=>{"next_page_id"=>"KS5ad82889e04e5806e0455d5a81e81a9511",
 "description"=>"linking", "utf8"=>"", "authenticity_token"=>"", "id"=>nil,
 "page_id"=>"KS000c29724a16-u-2TQMP57-gYm-U", "trigger_type"=>"Always",
 "base_options"=>"AllowAnonymous;BASE",
 "question_options"=>"KS000c29724a16CfC2TQUL1--gxG-U", "keyword_options"=>"",
 "qualification"=>"", "commit"=>""}, "page_id"=>"KS000c29724a16-u-2TQMP57-gYm-U"}
WARNING: Can't mass-assign protected attributes: id
Completed 500 Internal Server Error in 239ms

ActiveRecord::UnknownAttributeError (unknown attribute: utf8):
  app/controllers/page_branches_controller.rb:21:in `create'

Thanks to the response below:

I added the attr_accessible on my rails model:

attr_accessible :page_id, :page_name, :next_page_id, :next_page_name,
                :description, :trigger_type, :internal_qualification,
                :order, :form_id, :qualification

By doing that, I get the following warnings, but the build succeeds

WARNING: Can't mass-assign protected attributes: utf8, authenticity_token, id, base_options, question_options, keyword_options, commit
  • 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-31T21:37:30+00:00Added an answer on May 31, 2026 at 9:37 pm

    ActiveRecord mass assignment is gonna try to use every key/value pair in the hash is provided and raise an UnknownAttributeError when unknown attributes are supplied via mass assignment.

    Maybe checking out this code can help to confirm what I’m saying.

    I think you have two options:

    1. To clean up the params[:page_branch] before use it in the mass assignment.
    2. Modify the Backbone.YourModel.toJSON() to not send weird attributes to the server.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to follow this Rails/Backbone example but they are using erb and not
Trying to get my head around backbone.js. This example is using Backbone Boilerplate and
We've just started using Backbone and I'm trying to get a handle on a
I'm trying to test the change event of backbone collection, using this code: var
I'm trying to keep track of the state in this app using Backbone.js: I
Currently I am using backbone-rails in my Rails app. I would like to know
Basically, I'm trying to do something like this: Person = Backbone.Model.extend({ validate: { ...
I am trying to learn both Rails and Backbone.js at the same time. I
I'm using backbone with the backbone-rails gem which does its own templating and project
I have been using Backbone on a new project and so far have loved

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.