All Questions
Tagged with ruby-on-rails json
5,114
questions
0
votes
1
answer
85
views
Sending data from Rails to get validated in JSON Schema
In my app I am sending product information in various types (string, integer, float, and boolean) for validation by a JSON Schema.
I noticed today when attempting to send false boolean values for ...
0
votes
1
answer
120
views
i can't render partial js from controller rails 7
I've created my_portfolio.html.erb with form submission to controller with remote: true , the controller take the params and verification everything work fine with condition and code, but it's can't ...
0
votes
0
answers
43
views
Why I see ajax response instead of view in my RAILS 5 app
I have button which submit login form. This button generate POST request for my session controller
Started POST "/login" for 127.0.0.1 at 2024-04-03 10:49:13 +0300
Processing by ...
0
votes
0
answers
50
views
Code change works in local machine but not in staging server
In a predetermined format, csv files can be uploaded and in the process it gets pursed through an algorithm every time we upload a dataset. One of the categories for check is the name of the countries ...
0
votes
0
answers
113
views
Rails 7: How to rename as_json keys
I have a rails 7 api that returns a nested json file, but I want to change one of the names. I have tried many things but none of them works all the methods I find online are outdated and don't work, ...
1
vote
1
answer
208
views
Anyway to get JSON schema to recognize null OR string type as valid without using type "null"
I understand that the typical response to this is to use
"type":"["string", "null"]
But the OpenAPI version we have is 3.0.x, not 3.1 so the type of null is not ...
0
votes
1
answer
57
views
Cannot use the helper method `current_user` in devise
I am building a simple todo app with nextjs and rails.
I am using devise for user authentication, but I can't use current_user.
Specifically, I am using JSON API Serializer to return user information ...
-1
votes
2
answers
204
views
How to convert large active record data to json format - laptop get stucked and get hang during data.to_json - export, import in ROR
user_mails = UserMail.all
data = {user_mails: user_mails}
File.open("demo_data.json", "w") { |f| f.write data.to_json }
json_data['user_mails'].each do |data|
UserMail.where(...
0
votes
0
answers
61
views
Recover from Rails JSON ParserError Caused by Tabs
What is the best way to recover from JSON with illegal characters (like tabs). Would it be reasonable to simply escape the tabs on failure?
Please advise:
module ActiveSupport
module JSON
class ...
0
votes
0
answers
34
views
Deep search for a value in a hash [duplicate]
I would like to analyze several hashes to extract certain specific information.
These hashes have a global tree structure, however each of the branches of this tree structure is not always present in ...
0
votes
1
answer
103
views
ERROR: could not identify an equality operator for type json
I'm getting the error
ERROR: could not identify an equality operator for type json
when launching the SQL query
update pdfs
set forced_payload = datatable.forced_payload,
s3_original_path = ...
0
votes
1
answer
55
views
How to pass ids and names to d3 from rails
As with any rationalized database, the IDs, names and data are stored in separate tables. The current script (below) shows the IDs in the legend but I would like to pass in and show the names. The ...
0
votes
3
answers
116
views
How to parse json string data having symbols as key instead of string in Ruby?
Here's the json string example
json = "{:status=>\"ok\", :hitcount=>\"1\", :request_date=>Wed, 10 Oct 2019 00:00:00 +0000}"
I have tried below mentioned snippet ...
0
votes
1
answer
121
views
Ruby: How to pass parameters to oj_serializers
I'm using Oj Serializer: https://github.com/ElMassimo/oj_serializers.
I want to know how can I pass some variable(eg. CurrentCurrent) from controller to Serializer?
This for example controller:
class ...
0
votes
0
answers
136
views
Rails eager loading detected when loading
I have these errors when loading page.
USE eager loading detected
Notification => [:actor]
Add to your query: .includes([:actor])
Call stack
.../views/api/notifications/index.json.jbuilder:6
...