@ vs self in models?

i've seen both of these syntaxes before and have also used both in my
own models:

class Foo
  def get_bar
    @bar
  end
end

and

class Foo
  def get_bar
    self.bar
  end
end

seemingly with no difference... i'm a nuby though so could anyone
enlighten me to the differences if there are any?

thanks,
jeff

@bar is an instance variable... self.bar would be a method. Try doing
this code in irb and you'll see that calling get_bar in the first
version returns nil, while calling it on the second version throws a
NoMethodError.

b

jemminger wrote:

aha! i guess then the reason it has worked in RoR models is due to AR
creating attr_accessors for the table columns, so calling
model.some_col was returning @some_col... thanks for clearing that up