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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:31:15+00:00 2026-06-01T20:31:15+00:00

I am using Ruby on Rails (3.2.2), globalize3 (0.2.0) and batch_translations (0.1.2) ruby-gems. I

  • 0

I am using Ruby on Rails (3.2.2), globalize3 (0.2.0) and batch_translations (0.1.2) ruby-gems. I would like to solve the following problem generated when using the batch_translations ruby-gem:

ActiveModel::MassAssignmentSecurity::Error in Admin::ArticlesController#update

Can't mass-assign protected attributes: translations_attributes

In my ROOT_RAILS/Gemfile file I have:

...
gem 'globalize3'
gem 'batch_translations'

In my ROOT_RAILS/app/models/admin/article.rb file I have:

class Admin::Article < ActiveRecord::Base
  translates :title

  # This is needed to make the batch_translations to work.
  accepts_nested_attributes_for :translations

  ...
end

In my ROOT_RAILS/app/views/admin/articles/_form.html.erb file I have:

<%= form_for(@admin_article, :url => admin_article_path) do |f| %>
    <%= f.label :title %><br />
    English translation:
    <%= f.text_field :title %>

    Italiano translation:
    <%
      # Note: I am using the '<%= f...' instad of '<% f...' otherwise
      # batch_translations doesn't output the input field in the
      # front-end content.
    %>
    <%= f.globalize_fields_for :it do |g| %>
      <%= g.text_field :title %>
    <% end %>
<% end %>

In my ROOT_RAILS/app/controllers/admin/articles_controller.html.erb file I have:

class Admin::ArticlesController < ApplicationController

  def update
    @admin_article = Article.find(params[:id])

    respond_to do |format|
      if @admin_article.update_attributes(params[:article])
        format.html { redirect_to admin_article_path(@admin_erticle), notice: 'Article was successfully updated.' }
        format.json { head :no_content }
      else
        format.html { render action: "edit" }
        format.json { render json: @admin_article.errors, status: :unprocessable_entity }
      end
    end
  end

  ...
end

When I show the edit form all works, but when I submit that form I get the error mentioned above. How can I solve the above error?


UPDATE

I found the solution by using the following code in the ROOT_RAILS/app/models/admin/article.rb file:

class Admin::Article < ActiveRecord::Base
  translates :title

  attr_accessible :translations_attributes
  accepts_nested_attributes_for :translations

  ...
end

… but making the :translations_attributes accessible is it sure?

  • 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-06-01T20:31:17+00:00Added an answer on June 1, 2026 at 8:31 pm

    This will be an issue with the newest version of rails since they patched it. You can change it in the config. See http://weblog.rubyonrails.org/2012/3/30/ann-rails-3-2-3-has-been-released/ for details.

    I can confirm that your attr_accessible solution is correct.

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

Sidebar

Related Questions

I am using Ruby on Rails 3.1.0 and I would like to properly generate
I am using Ruby on Rails 3.0.9 and I would like to seed the
I am using Ruby on Rails 3.1 and I would like to understand how
I am using Ruby on Rails 3.1 and I would like to know (for
I am using Ruby on Rails 3.0.7 and jQuery 1.6.1. I would like to
I am using Ruby on Rails 3.0.7 and I would like to install and
I am using Ruby on Rails 3.1 and I would like to know how
I am using Ruby on Rails 3.1 and I would like to know how
I am using Ruby on Rails 3 and I would like to update an
I am using Ruby on Rails 3 and I would like to set some

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.