Skip to content
Snippets Groups Projects
Commit 16e9b3a6 authored by Mauricio Giacomini Girardello's avatar Mauricio Giacomini Girardello
Browse files

now, collection can add and remove learning objects

parent a7b3de1c
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,31 @@ class Collection
super(params.merge(defaults))
end
##
# Add +learning_object+ to collection
#
# After adding some learning object to collection, you must use CollectionRepository to persist
# the changes.
#
# Example:
# @test_collection = Collection.new(name: 'test', description: 'test', owner: current_user)
# @test_collection.add @learning_object
#
# @test_collection.learning_objects # [@learning_object]
# collection_repository.save @test_collection
def add(learning_object)
learning_objects.append learning_object
end
##
# Remove +learning_object+ from collection
#
# After remove some learning object to collection, you must use CollectionRepository to persist
# the changes.
def remove(learning_object)
learning_objects.delete learning_object
end
private
def defaults
......
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