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
337
questions
0
votes
0
answers
23
views
JBuilder and Rails 6.1
I am working on a POC for switching from active-model-serializer to jbuilder. I am very sad to see AMS being relegated to unsupported status. It's going to take forever to convert our 200+ serializers ...
0
votes
2
answers
69
views
Can't filter in a join table
I am creating an API in ruby on rails and I have 3 tables Invoice, Package and Additional_charge.
Invoice has many Packages and Packages has many Additional_charges
I have this query:
invoices = ...
0
votes
0
answers
51
views
jbuilder with Condition if .present?
if presenter.present?
@presenter = presenter
end
json.extract! @presenter.shop, :id, :name
json.schedule @presenter.formated_schedule
and i have this error
NameError:
# undefined local ...
2
votes
1
answer
98
views
Why the json.partial! line in jbuiler template is not executed when passing locals using new hash syntax?
I have this line in my jbuilder template using the new hash syntax. It seems this line is not executed at all.
json.partial! 'comments', post:, comments:
If I modify the line back to the old syntax ...
0
votes
1
answer
45
views
How do I render an easypost address by id from a user?
I am trying to find the address by the "address_id" column in the user model to then render that address.
Note: Since this is easypost I did not make the address model itself and there is no ...
0
votes
0
answers
112
views
Use jBuilder template to make a Hash
Is there a way to get jBuilder to generate a Hash from a template instead of a string?
render(template: "foo", formats: :json) will return stringified JSON.
I can of course parse the ...
1
vote
1
answer
214
views
Rails jbuilder error: ActionView::Template::Error (undefined method
I have a Rails 6 app and we're using jbuilder to define the shape of JSON responses.
Recently, I started getting the following error:
ActionView::Template::Error (undefined method `empty?' for #<...
0
votes
1
answer
31
views
How do i put entities into props after fetching it from componetDidMount?
inside componentDidMount Im calling the dispatched fetchReviews. but once mounted how does the fetched reviews get set in props?
business show component:
import React from "react";
import { ...
0
votes
0
answers
85
views
JSON response with nested calculated key in ROR
I have a model and I need to group some of relations and make json response.
For example i have Models:
users: {
orders
...
}
orders: {
order_group
items
...
}
items: { ... }
order_groups:...
0
votes
1
answer
115
views
How can I change an array into an object in jbuilder when it is the value of a key?
I'm using rails and I'm formatting the response with jbuilder and associations. Here is the code that I have
json.comments @post.comments.each do |comment|
json.set! comment.id do
json....
2
votes
2
answers
797
views
Rails not able to find partial
I have a folder structure like
project/app/views/api/users/_user.json.jbuilder
The error is
Searched in:
* "/Users/name/Desktop/etc/etc/project/app/views"
ActionView::MissingTemplate - ...
1
vote
1
answer
132
views
How should i test controller with jbuilder views?
this is my controller
class NewsController < ApplicationController
def show
@news = News.find_by id: params[:id]
end
end
this is views
json.extract! @news ,:id, :title , :...
1
vote
1
answer
202
views
Adding an attribute to json from joined table
I am trying to provide a json that would contain information coming from two tables:MenuItem, and Partner.
In the json below "partner_number" would actually come from the partner table.
{
...
2
votes
1
answer
862
views
Assigning jBuilder output to a variable
I have a Ruby on Rails App that uses jbuilder. I am using jbuilder to help render json responses. Is there a way assign the jbuilder partial to a variable without rendering the result? I have been ...
0
votes
0
answers
95
views
Json JBuilder array from key value pairs
In my current JSON output I have key value pair like this
"genres":[{"id":3,"name":"Biography"},{"id":1,"name":"Drama"},{"id&...