Where title
is a field on the table in the database, why does calling @title
return nil
?
Unbelievably, accessing model fields from inside a method on that model is undocumented.
Where title
is a field on the table in the database, why does calling @title
return nil
?
Unbelievably, accessing model fields from inside a method on that model is undocumented.
Think about how you would access the info from outside the model:
model_instance.field_name
Therefore, from within the model you simply call
field_name
you can call instance methods from within that instance.