Dumb question: what is attr_xxxx

i’m very new to the rails scene and am seeing lines of code like
attr_reader, attr_writer, attr_accessor, etc… and have no idea what
they do. reading the section in the book i’m reading that explains the
previous block of code says nothing about it really.

I can recommend reading up on your Ruby syntax. The pick axe book is an
good start. Its for sale in any bookshop but also on-line here:

“attr_reader” is a method that will generate an instance variable, and a
reader (a.k.a. getter) for it in your class. The others also create
setters, etc.

Have fun,

Josh K. schreef:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs