Why does access_attributes have an empty string?

I'm just trying to understand part of Rails, especially around the available_ attributes

See an example below:

irb(main):001:0> Ec2TypeSpecification.accessible_attributes => #<ActiveModel::MassAssignmentSecurity::WhiteList: {"", "api_name", "api_size", "api_type", "cores", "core_type", "compute_units", "ebs_optimization", "ephemeral_drives", "io_performance", "max_ips", "memory", "name", "support_32_bit", "support_64_bit", "total_ephemeral_storage"}> 

Why is the line blank? What does it do? Or is something broken with my model?

gem 'rails', '3.2.13'

EDIT: add model

What is the whole model (I'm not very far in my project)

 class Ec2TypeSpecification < ActiveRecord::Base attr_accessible :api_name, :api_size, :api_type, :cores, :core_type, :compute_units, :ebs_optimization, :ephemeral_drives, :io_performance, :max_ips, :memory, :name, :support_32_bit, :support_64_bit, :total_ephemeral_storage end 
+4
source share
1 answer

It represents the default value:

 attr_accessible nil 

The whitelist is a wide-open whitelist, so by default you need to specify other parameters that you want to assign to the mass as attr_accessible. Instead of a pure whitelist, this is a whitelist containing zero.

 # nil.to_s = "" 
+3
source

All Articles