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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:40:38+00:00 2026-06-13T04:40:38+00:00

I am using RABL to generate JSON responses. I am having trouble achieving the

  • 0

I am using RABL to generate JSON responses. I am having trouble achieving the following structure:

{
  "articles": [
     {
        "created_at": "2012-10-20T15:57:31Z",
        "description": "MK DEsc",
        "id": 1,
        "title": "MK Title",
        "updated_at": "2012-10-20T15:58:14Z",
         media:[{
            id : 1,
            title : "title"
        }]
     },
     {
        "created_at": "2012-10-20T16:38:24Z",
        "description": "fdsfdffffffff",
        "id": 2,
        "title": "asdads",
        "updated_at": "2012-10-20T16:38:24Z",
         media:[{
            id : 1,
            title : "title"
        }]
     }
   ]
}

I have a @artices object which contains media array. i have rabl config setup like:

   config.include_json_root = false
   config.include_child_root = false

my .rabl template so far looks like this:

object false
node :articles do
  @articles.each do |article|
  end
end

i am unable to add the media info inside this structure.

any help is appreciated

  • 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-13T04:40:39+00:00Added an answer on June 13, 2026 at 4:40 am

    I have managed to do this like so:

    collection @articles, :root => "articles", :object_root => false
    attributes *Article.column_names
    
    child(:media) do
      attributes *Medium.column_names
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using RABL in Rails 3.2.x, given the following controller action: respond_to :html, :json def
I am trying to create a json file from a rake task using rabl.
I am generating json using rabl . It is a bit disturbing and probably
I'm using the RABL gem to render JSON user data for users of comments
I am using Jbuilder (and I also tried to use Rabl) to render json.
In my rails 3.2 app, I'm using jbuilder to render responses from my JSON
I've built a JSON API using Rails 3 and RABL The API works well
I'm using RABL to render JSON. I have these models: Project Task User The
I'm trying to render a pretty simple data structure using RABL, but I can't
I'm using rabl 0.6.13, rspec-rails 2.10.1, and rails 3.2.6. I'm trying to spec my

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.