aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorZog2018-01-11 13:34:30 +0100
committerZog2018-01-11 13:34:30 +0100
commit8b3702a4c7f873e01e543034841de5dbecc30c06 (patch)
tree47f59d9dcc722dfb9993e99f1e2d979eabc6ffbe /app/models
parent40546b58557a939ceb6f60c1dfc8ff14444e9d20 (diff)
downloadchouette-core-8b3702a4c7f873e01e543034841de5dbecc30c06.tar.bz2
Refs #5551; Update CustomField api to better suit JS API needs
Diffstat (limited to 'app/models')
-rw-r--r--app/models/chouette/vehicle_journey.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/models/chouette/vehicle_journey.rb b/app/models/chouette/vehicle_journey.rb
index a8c9c1824..32f3cb731 100644
--- a/app/models/chouette/vehicle_journey.rb
+++ b/app/models/chouette/vehicle_journey.rb
@@ -256,8 +256,15 @@ module Chouette
end
end
+ def self.custom_fields
+ CustomField.where(resource_type: self.name.split("::").last)
+ end
+
+
def custom_fields
- CustomField.where(resource_type: self.class.name.split("::").last)
+ Hash[*self.class.custom_fields.map do |v|
+ [v.code, v.slice(:code, :name, :field_type, :options).update(value: custom_field_value(v.code))]
+ end.flatten]
end
def custom_field_value key