In below code you call rating
on Song which is a class, that's why its throwing an error.
Song.instance_methods
clearly shows that :rating and :rating= are in the list of Song class as a instance method. you can call that method on Song.new
instance, but not on Song
class.
you should call rating method like this:
@rating = Song.new.rating
Song.new.rating = "good"
in place of this:
@ratings = Song.rating
Hope it will help. Thanks