Skip to content
Snippets Groups Projects
Commit caa28dd3 authored by Matheus Agio Nerone's avatar Matheus Agio Nerone
Browse files

setting defaults attributes for learning object and draft


Signed-off-by: default avatarman13 <man13@inf.ufpr.br>
parent 7610a899
No related branches found
No related tags found
No related merge requests found
......@@ -20,7 +20,6 @@ class LearningObject
validates_presence_of :name, :created_at, :type
def initialize(params={})
status = 'active'
super(params.merge(defaults))
end
......@@ -104,7 +103,11 @@ class LearningObject
def defaults
{
downloads: 0,
score: 0
score: 0,
status: 'active',
attachments: [],
created_at: DateTime.now.strftime("%Y-%m-%d %H:%M:%S"),
last_modified: DateTime.now.strftime("%Y-%m-%d %H:%M:%S")
}
end
......
......@@ -7,4 +7,9 @@ class LearningObject::Draft < LearningObject
def valid?
true
end
def to_orientdb_hash
super.merge('@class' => 'LearningObject')
end
end
\ No newline at end of file
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