Skip to content

has_many relation result order issue. #1718

Answered by jwoertink
zw963 asked this question in Q&A
Discussion options

You must be logged in to vote

Yeah, it looks like you added query code to the model. That initialize was never being called.

As for doing the relation, that's not possible at the moment. luckyframework/avram#85

I want to add it in, but I tried, and it's really hard. luckyframework/avram#584

For now, what I do is just create a new method on the model that builds the query how I need.

class Post < BaseModel

  def blocked_comments : CommentQuery
    CommentQuery.new.post_id(self.id).blocked(true)
  end
end

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by zw963
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants