How would you create getter and setter methods in Ruby?
How would you create getter and setter methods in Ruby?
Setter and getter methods in Ruby are generated with the attr_accessor method. attr_accessor is used to generate instance variables for data that's not stored in your database column.
You can also take the long route and create them manually.
Comments
Post a Comment