DEV Community


Discussion on: SQL query from the view: considered hazardous!

kinnalru profile image
Samoilenko Yuri • Edited

But where to define interface class PostListItem?

kgilpin profile image
Kevin Gilpin Author • Edited

This is all you need to do to define this type with the listed attributes:

PostListItem =, :username, :attachments)
Enter fullscreen mode Exit fullscreen mode

It's now a Ruby class with a defined initialize method and many other convenience methods such as to_h.