How to properly pass an array of values to the `attr_accessible` method?
arrays, attr-accessible, ruby, ruby-on-rails, ruby-on-rails-3
Solution
Just like this :
attr_accessible *array
Problem
I am using Ruby on Rails v3.2.2 and I would like to handle an array of symbols so to pass its values to the `attr_accessible` method as well as it should be made. That is, I have: ``` attr_array = [:one, :two, ...] ``` If I use: ``` attr_accessible attr_array ``` I get the following: ``` self.accessible_attributes.inspect # => #<ActiveModel::MassAssignmentSecurity::WhiteList: {"[:one, :two, ..."]}> ``` However, I would like to get: ``` # => #<ActiveModel::MassAssignmentSecurity::WhiteList: {"one", "two", "..."}> ``` as well as it should be made. How can I make that?