Skip to main content

All Questions

0 votes
0 answers
119 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 ...
hrdwdmrbl's user avatar
  • 5,179
0 votes
1 answer
123 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....
lj_tang's user avatar
  • 21
2 votes
2 answers
846 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 - ...
TedTran2019's user avatar
  • 1,007
1 vote
1 answer
217 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. { ...
Blaise's user avatar
  • 89
0 votes
0 answers
62 views

Navigating jbuilder to attatch html string

I am setting up a collection of ruby issues (@issues) into arrays using jbuilder so they plug into datatables. Normally with datatables each row represents a single record and you determine the ...
Rajin Tech's user avatar
1 vote
1 answer
302 views

Rails returns HTML, even with `application/json` set and `.json` added to resource

Attempting to render JSON via Jbuilder when an XHR request is sent to Rails, and HTML when a normal request is sent. But every request still returns HTML. Without JBuilder PostController has a show ...
GN.'s user avatar
  • 9,567
0 votes
1 answer
344 views

Need to create a json string from Jbuilder in rails Helper

I need to create a complex json from my Rails helper I tried to use Jbuilder for that. I tried a code from a xxxx.json.jbuilder and it is working great. json.array! @demandes.includes(....) do |...
Geely JO's user avatar
1 vote
1 answer
1k views

How can I change the name of a key using jbuilder

I have an index.json.jbuilder which looks like this: json.results do |result| json.array! @artists do |artist| json.extract! artist, :id, :name end end This produces the follow JSON ...
Pseudo-Hippy's user avatar
1 vote
1 answer
889 views

How to generate a custom json response with Jbuilder & Rails

In my Ruby on Rails app, bike rental companies can manage all their bikes (reservations, payments etc.). Context I would like to offer a bike rental companies (shops) the option to implement a ...
techquestion's user avatar
0 votes
1 answer
187 views

Rails define custom json structure

I'm attempting to structure a json response to mimic an existing structure we have elsewhere in our application (using jbuilder templates). In this specific use case, we are unable to use the jbuilder ...
ncarroll's user avatar
  • 118
0 votes
1 answer
368 views

How to format jbuilder value

I got a jbuilder response like below { "name": "amb_devcernerpowerchart_com:patient_val2", "value": "{\"value\"=>\"patient_value\", \"expiration\"=>31536000, \"created_datetime\"=>\"2019-...
Mahantesh's user avatar
  • 439
3 votes
2 answers
2k views

Rails 6, standalone Jbuilder in a service : partials not loading

I thought I could use Jbuilder outside of Rails controllers. The documentation said so. I wrote this module, to include into a service object. Which is integrated in a Rails 6 api app, but is not ...
Ruff9's user avatar
  • 1,192
1 vote
1 answer
2k views

Jbuilder include All Attributes and Associations

I'm trying to set up a JSON object that I can make a clone of, so I need Jbuilder to list all object attributes and associations. I've done plenty of pick and choose JSON structures using Jbuilder, ...
Travis Smith's user avatar
0 votes
1 answer
1k views

Rails render index (JSON) after update returning empty array

In my small Rails app, I want to update an object through json format, and on success receive the index.json.jbuilder content (using the render :index on JSON format in update). But for some reason, I ...
soykje's user avatar
  • 199
1 vote
1 answer
2k views

Why is Rails not finding my jbuilder template or not rendering it?

I have a route that looks like this: resources :property_searches, :path => 'search' That generates these routes: property_searches GET /search(.:format) ...
marcamillion's user avatar
  • 33.6k

15 30 50 per page
1
2 3 4 5
10