Tagged Questions
1
vote
1answer
13 views
Export Rails model validations to hash
I'm looking for engine which export rails model validations to hash/json for me. I found gem client-side-validations, but this is complex solution, I just need export validations to frontend in json.
...
0
votes
0answers
9 views
JBuilder dynamic keys for model attributes
I'm trying to build a JSON file to access a product's variation via a variation code. Ideally, I could call variations.abcdefgh essentially asking to define a structure like this:
{
"variations":{
...
-1
votes
2answers
27 views
How to set route to controller which updates specify model?
I have SettingsController which allows me manage User's settings.
class Api::V1::SettingsController < Api::V1::BaseController
def show
@user = User.find(params[:id])
end
def update
...
0
votes
2answers
20 views
How to parse JSON to display in a Rails View?
I'm just trying to do a quick currency conversion using the Google API and display just the "rate" information in a rails view using either jQuery or a Rails method.
The returned JSON is in this ...
0
votes
1answer
25 views
How to send hash in json and update serialized attribute?
I have settings attribute in users table with is serialize attribute. I am using curl to update this attribute.
In my User model I have
serialize :settings
I am trying to update User via curl
...
0
votes
2answers
26 views
Export json to excel
Context:
I have a search page which retrieves data from one database table and I display it like a pivot table using a bunch of jquery plugins and some written code.
What I want to do: export both ...
0
votes
2answers
32 views
Parse JSON with Ruby
I have two JSON returns.
One I am able to parse fine
{"login"=>"foo", "id"=>bar,
with
@foobar_collect["login"]
But one I am having issues with
{"items"=>[{"user_id"=>foo, ...
0
votes
1answer
22 views
Accessing attributes from other model
I have 3 models : User, Location, Picture. A Location has several pictures, and a User can provide several pictures.
I use rabl to render the result of my query in json. My problem is that I don't ...
-1
votes
2answers
45 views
Merge two JSON with a matching ID in Rails
I got two JSON that are structured like this. First one comes from an API:
[
{
"course_code":"Basic 101 - 0913",
"name":"Basic 101",
"start_at":"2013-09-16T00:00:00+02:00",
...
0
votes
0answers
10 views
Rails active_model_serializer applied on grouped active record
I am using active_model_serializer from https://github.com/rails-api/active_model_serializers and currently want to apply the serialisation of my model to grouped active records.
I have a model that ...
0
votes
0answers
25 views
AngularJS removing data from postdata
I'm following the example from mightygio (http://mightygio.com/2013/05/integrating-rails-and-angularjs-part-3-rest-and-angular-resource) and would like to simplify the postData when updating.
...
0
votes
1answer
17 views
Responding with “*ok*” to a json callback in rails
I have been struggling with this issue for a while now. I am trying to interface with the Blockchain API using rails. The API notifies my app of a specific event by means of a callback and I have to ...
0
votes
1answer
8 views
Add virtual methods with parameters to as_json input
I got this model:
class Post
def rating_by(ip_address, user = nil)
if user
ratings.where("ratings.user_id = ?", user.id).first
else
ratings.where("ratings.ip_address = ?", ...
0
votes
2answers
13 views
POST error in rails
I am trying to create a new row in "Category" table in MySQL database through JSON send by my Android app. The server side coding is done in RubyOnRails. But I am getting Uninitialised constant error ...
2
votes
2answers
25 views
Unable to send JSON data from Android to ROR server
I am trying to send JSON data from my Android application to server. The database is MySQL and ROR is used for server side code. Below is the code used for sending data.
try{
...