Skip to content

Example "has many through" not compiling. #215

@Ash42Z

Description

@Ash42Z

I am running crystal 1.0.0 on linux. I set the clear dependency to branch: master.
Tried to compile this (Example from the tutorial):

require "clear"

class Post
  include Clear::Model

  primary_key

  column name : String
  column content : String?

  has_many tags : Tag, through: "post_tags"
end

class Tag
  include Clear::Model

  primary_key

  column name : String

  has_many tags : Post, through: "post_tags"
end

I got the following compile error:

Error: [has_many tags through: ...]: Cannot find the relation `post_tags` in model Post. Existing relations are: tags

Is this a bug or am I doing something wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions