Don't use `#to_s` to display models in Administrate.
Created by: rikkipitt
Just a minor note to request the documentation of the use of the to_s
method for better representing objects across the various Administrate dashboards. E.g. has_many
select lists and belongs_to
on index lists. This might catch out some newer Rails/Ruby users if not explicitly mentioned...
Something along the lines of:
to_s
is the standard Ruby method for converting an object to a string. You can defineto_s
on your model class when you want a custom string representation.
Example:
class Tag < ActiveRecord::Base
def to_s
name
end
end
Thus instead of displaying #<Tag:0x007fad07b7ad98>
, we can display the actual name of the tag.
Thoughts?