def model_ivar_set(value)
      name = if value.respond_to?(:klass) # ActiveRecord::Relation
               ivar_name(value.klass).pluralize
             elsif value.respond_to?(:each) # Array
               ivar_name(value.first.class).pluralize
             else
               ivar_name(value.class)
             end
      instance_variable_set(:"@#{name}", value)
    end
def model_ivar_set(value)
      name = if value.respond_to?(:klass) # ActiveRecord::Relation
               ivar_name(value.klass).pluralize
             elsif value.respond_to?(:each) # Array
               ivar_name(value.first.class).pluralize
             else
               ivar_name(value.class)
             end
      instance_variable_set(:"@#{name}", value)
    end
Sets an instance variable with the underscored class name if the given
 value. If the value is a collection, sets the plural name.