Skip to content

Tagging example #215

Description

@scalp42

In the tagging example, we can find posts having a certain tag with this:

Post.find(tag: 'tagging')

Now how would someone be able to get the posts matching a tag (pretty much reversed logic) ?

I'm assuming you would need a reference in the Tag model to the Post model but I can't quite figure it in the Ohm way:

class Tag < Ohm::Model
  counter :total
  reference :posts, :Post

# How would you query Tag model after that to find the posts associated ?

Any chance it could be added to the example ?

Thanks a lot!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions