DEV Community

Discussion on: Understanding attr methods in Ruby!

Collapse
 
joboccara profile image
Jonathan Boccara

Thanks for the nice recap. In the last example, what is the point of keeping :age in attr_accessor if it's already in attr_reader and that there is a manually defined setter for it?

Collapse
 
kateh profile image
Kate (she/her)

Ah, nice catch! We indeed do NOT need attr_accessor :age in the last example. I must have left it over as I copied over the code from a few examples ago.

Thank you for pointing it out, updated!