Hello,
I'm trying to run your app with ruby 2.1.5p273 and MongoDB 2.4.10 on Debian 8.7.
I get a lot of JS errors because object IDs are incorrectly converted to JSON:
{
"meta": {
"code": 200
},
"response": {
"election": {
"id": {
"raw_data": "X�\\u000f�:@&��\\u0000\\u0000\\u0001"
},
"name": "Election Presidentielle France 2007",
"namespace": "france-presidentielle-2007",
"published": true,
"date": null
}
}
}
Which leads to things like this:
<div election-id="[object Object]" class="election">
Doing something like this seems to fix the JSON:
diff --git a/app/views/api/v1/elections/search.json.rabl b/app/views/api/v1/elections/search.json.rabl
index 869abc1..8e8c417 100644
--- a/app/views/api/v1/elections/search.json.rabl
+++ b/app/views/api/v1/elections/search.json.rabl
@@ -1,6 +1,9 @@
object false
collection @elections => :elections
-attributes :id, :name, :namespace, :published, :date
+attributes :name, :namespace, :published, :date
+node :id do |election|
+ election.id.to_s()
+end
child (@only_published_candidacies ? :published_candidacies_sorted : :candidacies_sorted) do
extends "api/v1/candidacies/base"
end
diff --git a/app/views/api/v1/elections/show.json.rabl b/app/views/api/v1/elections/show.json.rabl
index a50c865..ce4a750 100644
--- a/app/views/api/v1/elections/show.json.rabl
+++ b/app/views/api/v1/elections/show.json.rabl
@@ -1,6 +1,9 @@
object false
child @election do
- attributes :id, :name, :namespace, :path, :published, :date
+ attributes :name, :namespace, :path, :published, :date
+ node :id do |election|
+ election.id.to_s()
+ end
# child :parent_election => :parentElection do
# attributes :id, :name
# end
Hello,
I'm trying to run your app with ruby 2.1.5p273 and MongoDB 2.4.10 on Debian 8.7.
I get a lot of JS errors because object IDs are incorrectly converted to JSON:
{ "meta": { "code": 200 }, "response": { "election": { "id": { "raw_data": "X�\\u000f�:@&��\\u0000\\u0000\\u0001" }, "name": "Election Presidentielle France 2007", "namespace": "france-presidentielle-2007", "published": true, "date": null } } }Which leads to things like this:
Doing something like this seems to fix the JSON: