Yes. Getting Adequate Sleep night in night out.

Image for post
Image for post
Disclaimer: You may or may not have improved your curry making skills by the end of this blog

So you’re going to build the next-gen eCommerce company selling dog supplies and you’ve decided to use React to build it with coz, you know, its all the rage now and choosing a front-end framework is the “first and most important responsible step” towards building any successful online business.

I’d like to share a neat trick I learned while building my own eCommerce website, obviously next-gen coz React!

Filtering products based on various aspects is a staple in any shopping site and so let’s add some filters to the product results page.

Image for post
Image for post
This is where our customers filter and find the right products for their dogs :)

As any ‘good’ React developer would, let’s break up this UI into components which is pretty straight forward in our case. …

Whenever I wanted to use placeholders in raw SQL query fragments in Rails, I would use ? and end up writing —

Post.where('published_at > ?', some_time)

What if I wanted to add another condition that checks against the same value in some_time ?

Post.where('published_at > ? OR saved_at > ?', some_time, some_time)

To be perfectly honest, writing such code never bothered me and I did not put in the little effort that was needed to see if there was a better way to do this.

One day I was pairing with one of my colleagues, Preethi Kumar, and she had something that looked like symbols in her query fragments, like this — published_at > :date . …


Steve Robinson

Software guy. #Ruby #ObjectDesign #Teams #DevOps

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store