We know that Rails 5 added ApplicationRecord
as an abstract class which was inherited by our models (ActiveRecord).
But basically, I think every technical requirement we do with ApplicationRecord, we can also do with ActiveRecord::Base
. For instance:
module MyFeatures
def do_something
puts "Doing something"
end
end
class ApplicationRecord < ActiveRecord::Base
include MyFeatures
self.abstract_class = true
end
So now every model will be attached the behaviors of MyFeatures
. But we can also achieve this in Rails 4:
ActiveRecord::Base.include(MyFeatures)
So what is the benefit of using ApplicationRecord
, do you think it is necessary to add ApplicationRecord
?
ActiveRecord::Base
now be broken as a result of this? If so that's a gigantic amount of maintenance and technical debt getting created. – Catercousin