Naming Convention for Null Objects in Rails?

For rails applications: does there exist a naming convention for naming your null objects that are mapped to model objects?


class Blog < ActiveRecord::Base

class NullBlog # Null Objects are POROs, correct?
  def title
    "No title"

# so to implement it I can do this:
blogs ={|id| Blog.find(id) ||}
# which allows me to do this and it works, even if some of those ids did not find a blog
blogs.each{|blog| blog.title}

Is NullBlog conventional?

Neither this article by Avdi Grimm nor the Nothing is Something presentation by Sandi Metz mentioned any null object naming convention.

Source: ruby

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.