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

  • SEARCH
  • Home
  • 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 7895369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:37:37+00:00 2026-06-03T07:37:37+00:00

I am using Jbuilder (and I also tried to use Rabl) to render json.

  • 0

I am using Jbuilder (and I also tried to use Rabl) to render json.
When I try to render the jbuilder template in my application it renders
the template within the layouts/application file and returns HTML as JSON (see line ‘within layouts/application’):

Rides controller on Github

Started GET "/random_photo.json"
Processing by RidesController#random_photo as JSON
>>  Rendered rides/random_photo.json.jbuilder within layouts/application (0.3ms)
    Rendered shared/_banners_in_corners.haml (3.0ms)
    Rendered shared/_sign_in_and_out.haml (2.0ms)
    Rendered layouts/_navigation.haml (7.3ms)
Completed 200 OK in 156ms (Views: 120.7ms | ActiveRecord: 3.1ms)

However, when I render the json without a template, and do a render json: @ride.as_json call, things work as expected.
When I create a new application and I try to do the same thing, everything works as expected as well:

Started GET "/posts/1.json"
Processing by PostsController#show as JSON
  Post Load (0.1ms)  SELECT "posts".* FROM "posts" WHERE "posts"."id" = ? LIMIT 1  [["id", "1"]]
  Rendered posts/show.json.jbuilder (0.6ms)
Completed 200 OK in 20ms (Views: 19.2ms | ActiveRecord: 0.1ms)

I don’t know what I have done with my application that it is not rendering the
templates correctly. Any ideas?

  • 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-03T07:37:38+00:00Added an answer on June 3, 2026 at 7:37 am

    Gosh, it took me about two days to find out that the issue that is causing this problem is
    my layouts/application file which was named aplication.haml.

    Now when I wanted to use a template engine like Builder for xml or Rabl for json, it tried to render the template within the yield field in the layouts/application.haml file and thus returning html as JSON

    I found out that the problem lies within the application.haml file

    naming it application.html.haml solved the problem…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When testing a JSON response from an RSPEC controller test using DHH's JBuilder, my
I'm building a simple JSON API using Rails 3.2.1 and Jbuilder on Ruby 1.8.7
I'm using JBuilder as to return some JSON. I have a index.json.jbuilder that generates
I'm using Backbone.js and thus bootstrapping data using a JSON (jbuilder) partial like so
I haven't touched Java since using JBuilder in the late 90's while at University,
using (var file_stream = File.Create(users.xml)) { var serializer = new XmlSerializer(typeof(PasswordManager)); serializer.Serialize(file_stream, this); file_stream.Close();
Using Android TelephonyManager an application can obtain the state of data activity over the
Using Xcode4.2.1, with a basic PhoneGap template based app. (I say template, but I
Using Spring MVC, do interceptors only intercept defined controller mappings or can they also
I'm using JBuilder 6 and running against Java 1.3 I'm migrating to Java 5

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.