2009/8/30 CoolAJ86 <coola...@gmail.com>:
>
>> Well yes - you still need to write the accessor methods to store you
>> instance variables (attr_accessor is probably enough).
>>
>> Fred
>
> That makes sense. Thanks.
>
> I had my JavaScript thinking cap on when I was doing this... thinking
> to create accessors out of thin air.
>
> I also just found out that the virtual accessors are accessors, not
> class variables.
> return @updated_at # always null
> return updated_at # works

Don't understand this.
As I understand it if you have
attr_accessor :my_var
then @my_var will access the variable (but this may only be written
inside the class)
and my_var is a method (well two methods actually) that may be used
externally to read/write to @my_var so you can say
my_object.my_var = 1
x = my_object.my_var

If you use my_var (no @) inside the class this should work but it is
calling the accessor methods rather than directly accessing @my_var

Colin

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to