This is the second step of a walkthrough of setting up a rom/rails project. The goal here is to add and configure an omniauth integration, pulling and storing user authentication data. Iâll also show how to restrict authentication to a particular domain.
This is a follow-on to 6022344535 where we initialize and configure a new rails app with rom-rails.
This is step one of a walkthrough for building a new app with
Iâll talk about my justifications and philosophy in another post; my intention
here is to walk through the initial creation of a
The end goal of this application is to serve as a file repository for use with another site. As I work throgh building the app, Iâll list out followons for some specific subjects of interest. This post highlights the initial generation and through to pulling some âhello worldâ content from a data store.
Some things will look simliar to the normal rails setup, but there are some variations that Iâll be illuminating here. As Iâve worked with Ruby and Rails for a long, long time, I (like Rails itself) Have Opinions, and since this is my blog, Iâll not be shy about sharing them. Hopefully, some of that will serve as jumping off points for posts Iâve been meaing to write for ages.
Recently, I and a number of colleagues spent the better part of a week chasing down some baffling behavior in a kafka consumer. After a routine1 cluster upgrade, we observed that one of the partitions in a deal publication topic was lagging further and further behind, negatively affecting our production processes.
By the end of the week, weâd chased down the issue, and have determined that it was the result of the confluence of a number of factors which had been lying dormant until the right combination of circumstances arose. I think the combination is subtle and interesting enough to peel back the curtain a bit and see what it was that bit us.
Also, this might qualify as therapyâ¦ Youâve been warned.
Not actually all that routine, as we blanked out all of our existing topics, chasing a clean start. This had the effect of changing the number of partitions on this topic.Â ↩
Sometimes, it looks like it is not possible to avoid using an accumulating array, a pattern that feels unnatural in Ruby.
Recently, Iâve need to chase down and unroll pagination links over a JSON / REST api. I donât know how many pages there will be, and itâs probable (but not guaranteed) that I need to retrieve and use all of the content. Since each page is dependant on results from the previous page, there is no obvious Enumerable parallel. Here, Iâll demonstrate a quick refactoring that will provide in a clean, lazy enumerable object.
I may be repeating something you already know, but this is not something I see talked about a lot, and Iâve run into this more times than I should.
Every so often, when Iâm combing through a Rails codebase, Iâll find code that looks something like this:
def some_method if Rails.env.production? # Do something for real else # Do something fake end end
This might be tied up in a Twitter callback, or it may be performing some other sort of expensive network computation. Or, it might be a switch to turn off a feature while itâs still in development. There are good reasons for applying this pattern â¦ but the way itâs applied leaves much to be desired.