DEV Community

Discussion on: Ruby classes seem pretty cool

Collapse
 
jeremyf profile image
Jeremy Friesen

In Ruby, I like to think of one class responsible for the content of the response document sent back to the requester:

class Api::Posts
  def to_json
  end
end
Enter fullscreen mode Exit fullscreen mode

And at the GET /api/posts endpoint, your response document is the results of calling Api::Posts#to_json. This is a simplification.

Collapse
 
danielarmbruster0314 profile image
danielarmbruster0314

Its all coming together now this is so sick! can't wait to try this out. thank you.