Throughout my application self. is not necessary to refer to a User's name. name works fine.
Why does the following code require self to work as intended?
class User< ActiveRecord::Base
    before_save :validate_name
def validate_name
    if self.name.nil? || self.name.empty?
        self.name= "Mr. No Name"
    end
end
By the way, I know that validates_presence_of can be used to prevent the save, but I want to save with a default if no name is given.
Rails 3.0.7.
 
    