activerecord - Creating readable models in rails -
i have started rails , coming .net background find model inheriting activerecord hard understand, since don't contain corresponding attributes model. cannot imagine new developer exposed large code models contains references other models , business logic.
from point of view datamapper model easier grasp since activerecord defacto standard feels weird change orm little problem.
datamapper
class post include datamapper::resource property :id, serial # auto-increment integer key property :title, string # varchar type string, short strings property :body, text # text block, longer string data. property :created_at, datetime # datetime, date might like. end
activerecord
class post < activerecord::base end
i'm not sure if issue , people used models without attributes, or how experienced rails user handle this?
i don't think using database manager or looking @ loads of migrations scripts find attributes option?
specifying attr_accessible make model more readable i'm not sure if it's proper solution problem?
check out annotate_models plugin on github. insert commented schema each model in comment block. can installed run when migrate is.
Comments
Post a Comment