Last active
August 21, 2020 10:06
-
-
Save equivalent/06f752d99b0d438759e3de22dbd2e9bd to your computer and use it in GitHub Desktop.
Ruby on Rails - Bounded contexts via interface objects - interface objects example 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
teacher = Teacher.find(567) | |
student = Student.find(123) | |
student = Student.find(654) | |
# Lesson creation | |
lesson = teacher.classroom.create_lesson(students: [student1, student2], title: "Battle of Kursk") | |
# Student uploads Work file | |
some_file = File.open('/tmp/some_file.doc') | |
lesson.classroom.upload_work(student: student1, file: some_file) | |
# publish lesson | |
lesson.classroom.publish | |
# post comment to work | |
work = Work.find(468) | |
work.public_board.post_comment(student: student2, title: "Great work mate!") | |
# Student marks lesson as favorite | |
lesson.public_board.mark_as_favorite(current_user: student1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a GIST for Medium mirror article Ruby on Rails - Bounded contexts via interface object
https://medium.com/@tomas.valent/ruby-on-rails-bounded-contexts-via-interface-objects-4fd61738acaa
Original article: https://blog.eq8.eu/article/rails-bounded-contexts.html
Full list of Article GISTs: