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 9246489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:30:05+00:00 2026-06-18T09:30:05+00:00

I have a Place model and a PlacesController . Currently the controller responds to

  • 0

I have a Place model and a PlacesController. Currently the controller responds to JSON with certain objects. I would like to add more fields to the responded objects. For example, I would like to add every place’s tags, queried by the method Place.tags.

I’m thinking in two solutions: convert the list of objects to a list of hashes and add the attributes that I want, or add a new column in the model, filling it in the controller iterating the list of objects. I’m not sure if there is a better way to do this.

  • 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-18T09:30:07+00:00Added an answer on June 18, 2026 at 9:30 am

    I’m assuming:

     class Place < ActiveRecord:Base
       has_many :tags
    

    If so, are you simply trying to add the associated tags to the place object’s json? If so, you can use (where ‘place’ is a Place object):

     place.to_json(:include=>:tags)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data structure that looks like this: Model Place primary key id
I have a C# model that gets populated through its constructor. I would like
I have two django models like these : class Place(models.Model): name = models.CharField(max_length=50) address
In my string I have place holders like: ##NEWSLETTER## , ##FOOTER# ##GOOGLEANALYTICS## etc. Each
I have such model: class Place(models.Model): name = models.CharField(max_length=80, db_index=True) city = models.ForeignKey(City) address
I have Django application with inline in place: class Account(models.Model): ContractNum = models.PositiveIntegerField(unique=True, blank=True,
I have a bit of a problem! I have a Place model and a
My Model, DataFile, has a bunch of fields which I'd like to set from
I have in-place editing set up for a network model. There are two input
I have models as follows: class Place(models.Model): name = models.CharField(max_length=300) class Person(models.Model): name =

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.