Skip to content

Instantly share code, notes, and snippets.

@equivalent
Last active August 21, 2020 10:06
Show Gist options
  • Save equivalent/06f752d99b0d438759e3de22dbd2e9bd to your computer and use it in GitHub Desktop.
Save equivalent/06f752d99b0d438759e3de22dbd2e9bd to your computer and use it in GitHub Desktop.

Revisions

  1. equivalent revised this gist Aug 21, 2020. No changes.
  2. equivalent revised this gist Aug 21, 2020. 1 changed file with 0 additions and 4 deletions.
    4 changes: 0 additions & 4 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +0,0 @@
    # Gist example


    Original article: https://blog.eq8.eu/article/rails-bounded-contexts.html
  3. equivalent created this gist Aug 21, 2020.
    20 changes: 20 additions & 0 deletions interface_objects_example_1.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    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)
    4 changes: 4 additions & 0 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    # Gist example


    Original article: https://blog.eq8.eu/article/rails-bounded-contexts.html