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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Think about how you would access the info from outside the model:
Therefore, from within the model you simply call
you can call instance methods from within that instance.