Skip to main content

All Questions

Tagged with
1,323 questions with no upvoted or accepted answers
14 votes
1 answer
1k views

Measuring rails json api with rack mini profiler

How do we get rack-mini-profiler to show in a rails json api? I believe this was asked here: How to profile a rails controller that returns a json response with rack-mini-profiler? but the only answer ...
user1848902's user avatar
9 votes
1 answer
3k views

Why does rails not recognize `Accept: application/json` in the request header?

I have some frontend javascript that makes an asynchronous http request to my backend rails server. On the frontend I am not using XHR (I use axios, although that's not entirely relevant to the ...
abhchand's user avatar
  • 535
7 votes
2 answers
514 views

Count items in arrays cross 100's of thousands of records

I have a Rails app with a Postgres database that has an Artists table with a jsonb genres column. There are hundreds of thousands of rows. Each genre column in the row has an array like ["rock", "...
Shpigford's user avatar
  • 25.2k
7 votes
1 answer
1k views

Rails 4.2 - Grape - IOError: Not opened for reading

I'm building an API with Grape on Rails 4.2. Here's a link to the repo on GitHub. On the frontend, I have a JavaScript application built with EmberJS. Here's the link to the repo on GitHub as well. ...
Lionel Rudaz's user avatar
6 votes
0 answers
3k views

JBuilder + OJ slow json rendering

I am rendering to json an array of records and their eager-loaded associations. Using ObjectSpace.each_object(ActiveRecord::Base) {|x| 1+1} I get 165 instances, thus my jbuilder views take 1 ...
Cec's user avatar
  • 1,796
5 votes
2 answers
991 views

Parsing Included Associations from JSON API response - Rails API, AMS, Vue.js SPA

I have some data that in a tree/hierarchal model for (climbing) Areas, such that they relate via parent and child areas. Using the JSON API adapter with my Active Model Serializer, class ...
C. Norwood's user avatar
5 votes
0 answers
176 views

Manipulating ActiveRecord objects to build JSON

We're trying to load a webpage faster. The main issue is about a few activerecord-generated queries on that page. If you look at the SQL they generate (Postgres), the queries are as follows (all code ...
Marco's user avatar
  • 51
5 votes
0 answers
1k views

Rails not parsing body of my request to params

Using Rails version 4.2.3 Postman generated request: POST /resources.json HTTP/1.1 Host: xxxx.xx:3000 Content-Type: application/json Cache-Control: no-cache Postman-Token: 68deca0d-7c6f-0948-cf2c-...
miushock's user avatar
  • 1,087
5 votes
2 answers
2k views

Postgres JSON column updating individual keys/attributes with form

I am having some trouble updating a rails JSON column in a model. I have a OrderItem model with an :options column with the postgres json datatype. I have a form where I am only trying to update ...
Joel Grannas's user avatar
  • 2,016
5 votes
1 answer
763 views

jQuery datepicker + Rails 3.2.8 + AngularJS: show and persist date issue

I'm having an hard time making the triad rails+angularjs+jQuery datepicker work together. The first issue is with showing the date as retrieved from the backend. When the UI requests data from the ...
CarmineM74's user avatar
5 votes
0 answers
2k views

Rails html encoding in json problem

Consider the following two scenarios: Ruby 1.8.7 Rails 2.3.2 {:a => '<div style="color:red;">asd</div>'}.to_json ?> {"a":"\u003div style=\"color:red;\"\u003Easd\u003/div\u003E"} ...
ZX12R's user avatar
  • 4,798
5 votes
2 answers
4k views

How do I include cookies within a JSON response in Rails?

I am making a PhoneGap-based iPhone app which will connect to a Rails backend. I'm using jQuery to create an Ajax request to Rails server. I'm successfully getting a server response, but I'm having ...
Chanpory's user avatar
  • 3,085
5 votes
2 answers
3k views

How to upload file via the JSON interface in Rails

I have a web service in Rails which among all else should provide file upload functionality to the clients. The clients all use JSON to talk to the webservice. I use the Paperclip plugin for upload ...
akafazov's user avatar
  • 465
4 votes
1 answer
2k views

Ruby/Faraday: How to translate and parse response body?

I'm using Faraday gem for API connection. The body of the response from my call looks this way: "\xEF\xBB\xBF{\r\n "uptime": "112795",\r\n "started_at": "2021-...
andrzej541's user avatar
4 votes
0 answers
78 views

Rails 'partial not found' masks underlying error

I encountered a sporadic error, ostensibly because Rails sometimes could not find a partial. However, because of the way the error only showed up in certain cases, I suspected, and then found, a ...
Leo's user avatar
  • 4,387

15 30 50 per page
1
2 3 4 5
89