Jeff Emminger wrote:
i’ve seen both of these syntaxes before and have also used both in my
seemingly with no difference… i’m a nuby though so could anyone
enlighten me to the differences if there are any?
This can be a real Gotcha in ActiveRecord. AR uses the missing
methods to give the illusion that it knows what columns you have in your
table. I believe that using the instance variable (@bar) now spews lots
of depreciation noeses onto stdout. Good programming practice it to
used the method call because you can then override that method call in
your class and massage the data before it goes out (or comes in). This
can eliminate the need for the get functions.
retval = self[:bar]
#do interesting thing with retval here