Skip to main content

All Questions

8 votes
2 answers
2k views

Why is ActiveSupport::JSON.encode so slow?

JRuby 9.2, Rails 4.2 I've been work with reading/dumping large JSON objects, 100+MB files, which would routinely hang for a few minutes then run out of memory when writing them out. I noticed it ...
Karl's user avatar
  • 6,135
1 vote
1 answer
872 views

ruby on rails vue and html.slim

I've started a ruby on rails application. In this one, we can found a search bar. Besides, the result is return by json format. And the view is updated by vue. In a first time my controller def ...
Kevin Araba's user avatar
1 vote
4 answers
884 views

Neat way to get and set keys of json column in Rails

I have a model/table with a json column in it as follows t.json :options, default: {} The column can contain many keys within it, something like this options = {"details" : {key1: "Value1", key2: "...
Bhavya's user avatar
  • 592
1 vote
1 answer
145 views

Rails render json to AngularJS frontend. Time becomes 00:00:00

I'm using Rails' render method to pass rendered json to the AngularJS frontend. The dates got successfully passed. When I try puts in the backend, the rendered json object also has the correct time. ...
Jack Jin's user avatar
-1 votes
2 answers
853 views

ActiveModel::UnknownAttributeError (unknown attribute 'order_itens_attributes' for Order.):

please help on this issue ActiveModel::UnknownAttributeError (unknown attribute 'order_itens_attributes' for Order.): mi code in the controller def create @order = Order.new(order_params) ...
Javier Joasimar Palos Flores's user avatar
1 vote
1 answer
224 views

how can I insert multiples record and save data in two tables in rails json

hello soem body can help me with one example in rails to do a post request to save multiples records and sabe data in diferents tables in json { "post": { "title":"Titlea 2", "body":"...
Javier Joasimar Palos Flores's user avatar
0 votes
1 answer
29 views

JSON format not displaying all model attributes (Rails 4)

I've run into a bizarre issue running Rails 4.2.7: When I look at the HTML index view for a particular model, everything seems fine. When I request the same data via JSON, I only get a subset of the ...
guero64's user avatar
  • 1,039
0 votes
0 answers
133 views

Rails 5: not rendering any respond_to json

I'm using byebug in order to see if the format.json { render json: @items.map(&:title) } is called. def search if params[:search] @items = Item.search(params[:search]).order("created_at DESC") ...
Theopap's user avatar
  • 755
1 vote
1 answer
36 views

Postgres JSON Rails Query

I have a record that looks like this: { properties: [1,2] } I want to search to find the field where the properties match exactly. Record.where("(query)") So far I tried things I found from this ...
RandallB's user avatar
  • 5,515
0 votes
0 answers
227 views

Rails 4: How to set a default for a custom data type?

I have a Rails 4.2 + MySQL 5.7 setup. I've created a custom data type for native JSON columns, which works fine, with one problem - if I set a default, it's not persisted. Specifically, if I set the ...
Marcus's user avatar
  • 5,225
-1 votes
1 answer
2k views

Ruby on Rails JSON.parse "unexpected token" error

I am trying to parse JSON data in my Rails 4 application with JSON.parse. I keep getting this error: 757: unexpected token at '<?xml version="1.0" encoding="UTF-8"?> <Error><Code>...
Amrinder Singh's user avatar
0 votes
1 answer
123 views

How to parse and pull data from json post in create method

Below is the JSON I am feeding my create method in my controller { "sex":null, "money":281, "networth":281, "property":[ { "houses":"1", "id":"5", "father"...
john samcock's user avatar
0 votes
1 answer
219 views

Error with input form with a json field in Rails 4.2

In my Rails 4.2 app with postgres, the field ui_layout is converted into json in the db table (psql supports json data type). The ui_layout used to be a text field. After converting ui_layout to json ...
user938363's user avatar
  • 10.3k
1 vote
1 answer
836 views

Could not log "render_template.action_view" event after rails upgrade to 4.2.8

I am in the process of upgrading a rails app that mostly serves JSON. The last working version I was able to upgrade to is 4.1. Once I upgraded to 4.2, request specs that produce strange errors in the ...
Daniel Becker's user avatar
2 votes
1 answer
205 views

Customise as_json response in ruby

I am building rest APIs in ruby I am using @object.as_json() for the response in json format I am getting stuck in the mid while transfer the data in as_json. I need to more customize the response ...
Rubyone Railsone's user avatar

15 30 50 per page
1
2 3 4 5
21