ruby on rails - ActiveRecord: class methods without scoping -
i need create class method of activerecord. method not meant scope, i'd prevent misusage of scope. possible do?
like kiddorails hinted, not possible. underlying reason ar puts many responsibilities 1 class -- validation, persistence, finding/querying. if care encapsulating these methods in 1 place, might consider creating separate class (which prevent 'misuse' nature has query-related methods) handles query-related logic. (there other strategies 1 consider well, too)
Comments
Post a Comment