I have a question about the ActiveRecord's validates
For example, with this code:
class Person < ApplicationRecord
validates :name, presence: true
def name
'hello world'
end
end
There is a getter method name to return a string as the name. There is also a column in the database table, whose name is name.
I understand that, when we call person.name, the method (not the db record) is used. However, for the validates, do we use the method's return value or the db records to check?
I tried to read the ActiveRecord source code, but quickly got lost :-( Any help or pointer is much appreciated!