Figured it out...
alias
and alias_method
need to come after the method you are aliasing to.
So both of the following work fine:
Using alias
class Person
def full_name
"#{first_name} #{last_name}"
end
alias to_s full_name
end
# In Terminal
> Person.last.to_s #=> "Don Draper"
Using alias_method
class Person
def full_name
"#{first_name} #{last_name}"
end
alias_method :to_s, :full_name
end
# In Terminal
> Person.last.to_s #=> "Don Draper"
Hopefully that helps somebody else.