Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A administrate
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 96
    • Issues 96
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 32
    • Merge requests 32
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • thoughtbot, inc.
  • administrate
  • Issues
  • #129
Closed
Open
Issue created Nov 02, 2015 by Administrator@rootContributor

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 define to_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?

Assignee
Assign to
Time tracking