Skip to content
Snippets Groups Projects
Commit 29f77c7a authored by Mateus Rambo Strey's avatar Mateus Rambo Strey
Browse files

change LearningObject's metadata column to jsonb

parent 29b358d0
No related branches found
No related tags found
No related merge requests found
...@@ -9,8 +9,8 @@ module Metadatable ...@@ -9,8 +9,8 @@ module Metadatable
def get_metadata_values_of key def get_metadata_values_of key
values = [] values = []
if metadata.is_a? String unless metadata.blank?
JSON.parse(metadata).each do |m| metadata.each do |m|
m = m.with_indifferent_access m = m.with_indifferent_access
values << m["value"] if m["key"] == key values << m["value"] if m["key"] == key
end end
......
...@@ -7,10 +7,10 @@ class CreateLearningObjects < ActiveRecord::Migration ...@@ -7,10 +7,10 @@ class CreateLearningObjects < ActiveRecord::Migration
t.text :description t.text :description
t.datetime :published_at t.datetime :published_at
t.string :object_type t.string :object_type
t.integer :score t.integer :score, default: 0
t.integer :school_level t.integer :school_level
t.string :language t.string :language
t.text :metadata t.jsonb :metadata, default: {}
t.text :bitstreams t.text :bitstreams
t.string :thumbnail t.string :thumbnail
t.text :keywords t.text :keywords
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment