Theoretical question on why this code doesnt work


#1



I know this code makes no sense (that im randomly testing), but im just trying to understand how ruby works. I do not understand why title to_sym = rating.to_i doesn't work. Any help or enlightenment is greatly appreciated.


Error message as follows
script.rb

undefined method `to_sym=' for "dog":String


title = "dog"

rating = "3"

title.to_sym = rating.to_i


#2

What are you trying to do?


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.