All Questions
304
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 ...
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 ...
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: "...
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. ...
-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)
...
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":"...
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 ...
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")
...
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 ...
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 ...
-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>...
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"...
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 ...
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 ...
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
...