Topic: Model Confusion: self.name vs. @name
I am new to Ruby and Rails and already programmed quite a bit, but I still don't get the difference.
If I have a model User that looks like this:
class User < ActiveRecord::Base
if self.logged_in == nil
Do I have to use self.logged_in to access the logged_in field of user1 (with ID = XY) or can I use @logged_in?
What is the difference, it is both instance variables for me, but sometimes the @xyz is not working and I have to use self.xyz.
When do you have to use what? What do I use to write to the table?
Thanks a lot!