I can't find any references to explain what the difference is between these two definitions. What is the purpose of using these two definitions like this?
def user_name=(name)
user= User.where(:name => name)
if user
self.user_id = user.id
else
errors[:user_name] << "Invalid name entered"
end
end
def user_name
User.find(user_id).name if user_id
end