Ognjen Regoje bio photo

MY NAME IS
Ognjen Regoje
BUT YOU CAN CALL ME OGGY


I make things that run on the web (mostly).
More /ABOUT me.

me@ognjen.io Twitter LinkedIn Github
Check out
The Marketplace Guide
A collection of lessons for the early stages of building a marketplace startup.
https://themarketplace.guide

#rails

March 18, 2021

How to get the direct path to a Webpacker pack

If you are making use of a serviceworker to cache JS or CSS or you’re rendering some JS server-side you have to have the full path to the file.If, at the same time, you’re using... (111)

March 21, 2020

Rails pattern: state params

A useful pattern that I didn’t see documented before is what I call “state params”: returning different permitted params based on the state of the record.If there is an order mo... (180)

March 21, 2020

mysql2 - activerecord version compatibility list

In the course of doing upgrades for an older project I’ve discovered that not every activerecord version is compatible with every mysql2 version. The adapters use ~> to lock ... (147)

November 16, 2019

Combining cached and live JSON in Rails

Had a scenario for the Supplybunny API where an endpoint needed to return a combination of live and cached data.The cached part was already in use in a few places. The new endpo... (132)

April 28, 2017

Building human readable link building in Rails

A while ago I needed to improve the canonical links for some of our pages, specifically because we added more search parameters etc. so I made use of routes file to create some ... (445)

February 28, 2017

Filling a number field in cucumber tests

In order to upload a file in a cucumber test, that is to use a file select input, define the following in your user_steps.rb: Then(/^I fill in number field "(.*?)" with "(.*?)"... (75)

February 26, 2017

Uploading a file in cucumber tests

In order to upload a file in a cucumber test, that is to use a file select input, define the following in your user_steps.rb: And(/^I attach "(.*?)" to "(.*?)"$/) do |field, fi... (67)

2016

October 19, 2016

Consistent display of dates in Rails

In order to consistently display dates in a Rails application the strftime format can be set globally.#config/initializers/time_formats.rbDate::DATE_FORMATS[:default] = "%d/%m/%... (59)

2015