Question:In the world of post-attr_accessible Rails 4, how do you recommend, if at all, annotating ActiveRecord model class files to pass in your attributes (database)?
Further thoughts
As part of the Rails 3 β 4 update, we are making a switch and, fortunately, so far from attr_accessible and to the strong parameters in the controller. I understand and agree to the improved security with this switch. If you want to know more about this, the information is there and it is not difficult to find.
But I liked Rails 3 in my world, having these reminders of which attributes made up the class there, at the top of the model file. Moreover, we are moving towards a world in which ActiveRecord classes are only DAOs, what else is a class, but a set of database attributes? I do not want to go to the schema.rb file to remember them.
Am I thinking about it wrong? In the DAO world, should I create an ActiveRecord model class file and then never open it again?
I know about annotate_models gem and used it the same day. I was not a fan of having the attributes described in numbered lines. (unreadable, hacker, fragile)
Thoughts? Opinions?
:
Person.column_names
IDE , , , . Ruby Rails, , Rails 4 , , , . , , ? , :
my_attr = [:fname, :lname, :age, :height, :weight]
, ? , attr_accessible, ? , rake, ,
rake db:...
my_attr , , . , , . RubyMine, DB , , .