Reading, Writing & Accessing

#When you do this: attr_reader :name #Ruby creates this for you behind the scenes 
def name
@name
end
#When you do this: attr_writer :name #Ruby creates this for you behind the scenes: def name=(value)
@name = value
end
#When you do this: attr_accessor :name #Ruby creates both of these for you behind the scenes: def name
@name
end
def name=(value)
@name = value
end

Senior Software Engineer | www.adriennedomingus.com

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Adrienne Domingus

Adrienne Domingus

Senior Software Engineer | www.adriennedomingus.com

More from Medium

Rails Project Reflection — A Ruby on Rails Recipe Manager

How to set up a mail sender in Rails?

Encryption in Rails 7

image of a padlock placed on a keyboard and next to some credit cards

Searching Users in a React/Rails Project