Questions tagged [jbuilder]

JBuilder is a IDE for Java developed by Embarcadero Technologies. It is also the name of a Ruby library for producing JSON.

JBuilder is a Java IDE from Embarcadero Technologies. It was originally developed by Borland in 1997, and now belongs to Embarcadero Technologies.

Jbuilder is also the name of a Ruby library that lets you "create JSON structures via a Builder-style DSL".

335 questions
0
votes
1 answer

Print associated mapped data in json jbuilder view file

I have a view file photo_feed.html.erb that prints what I need using the following: <% @photo_feed.each do |feed| %> <%= feed.id %> <%= feed.username %> <%= feed.photo_filename %> <%= feed.comments_count %> <%= feed.comments.map{|x| [x.username,…
0
votes
1 answer

Appending to existing / blank array

I have the following controller action which returns current users inbox messages (I'm using mailboxer): def index @conversations = mailbox.inbox render :template => "/api/communications/index.json.jbuilder" end This renders a json…
Mark Kenny
  • 1,598
  • 2
  • 17
  • 30
0
votes
1 answer

Creating a custom array with jBuilder

I'm trying to use jBuilder to construct a custom array which is the needed structure for my javascript function. In this case their is only 1 object in the array. I am aware of the array! method, but that requires the use of a collection. How do I…
Paul
  • 2,021
  • 5
  • 22
  • 33
0
votes
4 answers

Looking for old version of JBuilder

I'm looking for any of these versions:JBuilder 3-9, JBuilder X, or JBuilder 2005. The reason for this is because my computer is old (256 MB, 800 Mhz cpu) but I still like to program. (Yes, I should upgrade my computer but greenbacks don't grow on…
0
votes
2 answers

Pretty Print JSON with JBuilder

I am using JBuilder as a JSON DSL. I have it working properly but cannot figure out how to pretty print JSON. I want to use JSON.pretty_generate but that requires a string or a hash, and JBuilder is a custom JBuilder object that does not…
darksky
  • 20,411
  • 61
  • 165
  • 254
0
votes
1 answer

Display custom links above an array collection using Jbuilder

I have a custom JSON response in which I display a collection of 15 posts along with related data like comments etc., as part of an API call. I am displaying the entire collection using Jbuilder . json.array!(@posts) do |post| .. .. end I want…
boddhisattva
  • 6,908
  • 11
  • 48
  • 72
0
votes
1 answer

Handling requests of format */* for rails

When I curl or another server calls my server it interprets the format as */*. Since I've installed jbuilder it always repsonds with json. How can I adjust the preference order for formats to respond to */*.
Tal
  • 1,298
  • 2
  • 10
  • 20
0
votes
1 answer

Rails jbuilder giving me undefined entries in array

I'm building an array using jbuilder. This is the tree.json.jbuilder code: json.array!(@locations) do |location| if location.is_root? json.label location.name json.id location.id ... end end The json produced contains some…
Reddirt
  • 5,913
  • 9
  • 48
  • 126
0
votes
1 answer

rails jbuilder getting Called id for nil

I'm trying to use jbuilder gem to format json output. Controller class LocationsController < ApplicationController def tree @locations = Location.all end tree.json.jbuilder Jbuilder.encode do |json| json.id @location.id json.name…
Reddirt
  • 5,913
  • 9
  • 48
  • 126
0
votes
1 answer

How to build following to_json in JBuilder?

I have method in my model def indexed_json to_json( only: [:id, :chanell_id, :title], include: [ :locations, {categories: {only: [:name, :id]}} ] ) end I would like to rewrite that in JBuilder and also add another…
tomekfranek
  • 6,852
  • 8
  • 45
  • 80
0
votes
1 answer

Jbuilder gem standalone not rendering anything

Jbuilder standalone will not render anything. Do I need a configuration parameter to get it to work in Rails 3.2.8? 1.9.2p320 :257 > Jbuilder => Jbuilder 1.9.2p320 :258 > Jbuilder.new {|json| json.foo 'bar'}.target! => "{}" Thanks a million.…
0
votes
2 answers

Rendering Jbuilder view

I am using rabl for my api calls in rails application. Here is my sample code app.get '/item/:id' do @errors = [] @revisions = [] request.body.rewind # in case someone already read it @item = Entity.for_owner(params[:id], @user) render…
0
votes
1 answer

Different Updated At Date Depending on Context

When I access my data for a particular model in a list context, the updated_at date hasn't changed, however, when I access the same record in a individual (show) context, the date does appear to be changed. List Context Show Context I am using…
Matt Long
  • 24,438
  • 4
  • 73
  • 99
-1
votes
1 answer

passing associated object in json.array jbuilder

I have list of appointments in @appointments. I can access corresponding customer of an appointment like this appointment_object.customer Now I want to render customer partial file which accepts customer object. This is jbuilder file which renders…
krishnar
  • 2,537
  • 9
  • 23
-1
votes
1 answer

Rails: Generate Json response based on condition

How to generate conditional based JSON response in json.jbuilder file. For example: json.posts @posts do |post| post.id post.id post.users.each do |user| if user.status == true json.name user.name json.age…
Touqeer
  • 583
  • 1
  • 4
  • 19
1 2 3
22
23