For rails applications: is there a naming convention for assigning null objects that appear for model objects?
Example:
class Blog < ActiveRecord::Base
end
class NullBlog
def title
"No title"
end
end
blogs = ids.map{|id| Blog.find_by(id: id) || NullBlog.new}
blogs.each{|blog| blog.title}
Is it NullBlog
ordinary?
Neither this article by Avdi Grimm nor Nothing is Something Sandy Mets presentation mentioned any null object naming convention.
source
share