Looking to set up a class method that can return an array of instances. I'm running into some trouble about the point where I try to modify the instances' variables NoMethodError: undefined method 'name=' for #<Class:0x007fe65c8560c0>
.
class User
attr_accessor :name
def self.sample_users
megan = self.class.new
megan.name = "Megan"
jack = self.class.new
jack.name = "Jack"
[megan, jack]
end
end
I feel like this should be possible in Ruby. Any guidance?