Ask A Question

Notifications

You’re not receiving notifications from this thread.

Extracting Reusable Base Classes In Ruby Discussion

The cat is still playing in the background πŸ˜‚

Reply

He's always causing a ruckus or being lazy. Nothing in-between! 🐈

Reply

Is there any benefit to using the constant for the base URL instead of just using a method and overwriting it in each inherited client? Looking forward to the generator episode! I've been playing around with Rails generators recently to build out my own Rails template so I can stop copying/pasting code every time I start a new project.

Reply

A constant is faster to lookup since it's saved, but a method that returns the string would work fine too.

Also we just published the generators episode!

Reply

The new github api requires you to set the auth token in headers instead of query params. I changed the default_headers in GithubClient to use the new convention, here is the updated code if anybody needs that:

def default_headers
{
"Accept" => "application/vnd.github+json",
"Authorization" => "token #{self.token}",
}
end

Reply

Thanks Ashish!

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 83,038+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.