Finishing the scaffold (Trello clone P2)

In this episode we'll continue our Phoenix 1.4 Trello clone (which we started last episode).

We've already got a workable system for fixing tests generated by mix phx.gen.html after making associations between schemas and we'll continue using it. This time we'll do the comment and activity models, which are a bit more complex but progress is fast since we can lean on helpers we made in Part 1.

At the end our tests will be passing and our contexts and schemas will look like this:

  • ACCOUNTS
    • user --- username
  • TASKS
    • list
      • name
      • position: integer
      • belongs_to :user
      • has_many :cards
    • card
      • title
      • details, :text
      • belongs_to :list
      • belongs_to :user
      • has_many :comments
      • has_many :activities
    • comment
      • body, :text
      • belongs_to :card
      • belongs_to: user
    • activity
      • action: [completed, added, moved]
      • user_id, references: User,
      • from_id, references: List,
      • to_id, references: List
      • belongs_to :card

(Source code available for premium members)

Next episode: Part 3: Setting up SASS and Vue

Back to index

No Comments