Skip to content

Instantly share code, notes, and snippets.

@bezelga
Created September 3, 2014 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bezelga/ad2833c64e0678e34f1a to your computer and use it in GitHub Desktop.
Save bezelga/ad2833c64e0678e34f1a to your computer and use it in GitHub Desktop.
class TasksRepository::ActiveRecord
def persist(task_entity)
task = Task.create({ title: task_entity.title })
serialize task
end
def count
Task.count
end
private
def serialize(task)
Tod::Entities::Task.new(title: task.title).tap do |task_entity|
task_entity.id = task.id
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment