Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8107389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:45:15+00:00 2026-06-06T00:45:15+00:00

when using rails_admin for associated objects (like has_and_belongs_to) it shows the ID of the

  • 0

when using rails_admin for associated objects (like has_and_belongs_to) it shows the ID of the object as the association.
This isn’t a great deal for the users so I’ld like to change this for showing the text of the associated object.

Is this solvable?

Here a little example:

First Model:

class Menu
  include Mongoid::Document

  field :date, type: Date

  has_and_belongs_to_many :meal
end

Second Model:

class Meal
  include Mongoid::Document

  field :text, type: String

  has_and_belongs_to_many :menu
end

So it shows something like this:

So it shows something like this:

But I’ld love to see the Text of the meals instead.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T00:45:16+00:00Added an answer on June 6, 2026 at 12:45 am

    Simply define a title-method do the trick:

    def title
      self.text
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Rails 3.1 and under assets I have files like this: assets
I'm using Rails 3 and have a rich association between Projects and Users. The
I'm using rails_admin which use devise. Some words still displays in english. I have
I'm using Rails 3, ActiveAdmin and Kaminari. I have this on the documents.rb file
I started using rails_admin engine lately and can't quite figure out how I can
Using Rails 3.1.3 with Devise 1.5.3. My app has accounts and users. Each account
So I am using STI to incorporate some roles into my users table. Right
I'm using rails_admin , and since it is in (very) active development, bugs turn
I'm new to rails and I recently discovered rails_admin. I added CKEditor using the
I'm using rails_admin and devise in my rails 3 application and writing tests for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.