This is a simple example of adding a conditional and partial unique index to Rails applications backed by PostgreSQL.
Database migrations are the tricky part of any deployment. They make zero-time deploys problematic. They requires special attention since they can break stuff. Some might choose to run migrations automatically, some of us run them manually. But one thing is almost always true; the production code without migrations should not ever run. So how not to run your code without doing migrations first?
After some time with
1.0.0.rc1 I am releasing a final
1.0.0 of InvoicePrinter. So what it is it, what does it mean and what’s next? Continue reading
If you are using Ruby on Rails together with Devise gem you might be wondering
how to handle unauthorized error responces in your JSON API. Continue reading
This a very short note on setting up Capybara to correctly follow redirects with Rails classic
redirect_to @object pattern. Continue reading
At work I needed to accept a Windows-1250 encoding in URL parameters on some actions in one of our Rails API endpoint. The problem is that Rails will scream at you since everything needs to come as UTF-8. Future! Unfortunately some 3rd party Windows software might be still in the past… at that time I was trying to find a way how to write a middleware or patch Rails’ ActionPack to handle this request and what I found was actually a commit that adds this to Rails in master. Continue reading
Ruby on Rails come with three environments by default – development, testing and production. But sooner or later one has a need for staging environment. And don’t get me wrong, you can (or should?) use the production settings there, but if you run it locally or on the same server as production, chances are you need a different database. And while you are at it, it may be handy to allow logging to console or change any other of Rails settings for that matter. In fact you can create as many other environments as you want and since it’s really easy I encourage you to do so. Continue reading
They are many options how to generate PDF versions of your invoices in Ruby and the ones that do not come with system dependencies are often built on top of Prawn library. InvoicePrinter is no different. Here is a short announcement on what it is (and aims to be) and what not. Continue reading
If you have ever generated PDFs in your Ruby apps you were probably also asking yourself how do I test that the PDF turns out the way I want? Continue reading
If you are using Rails with
activerecord-postgis-adapter 3.1.4 perhaps you got into a point where you were suddenly getting the following error:
can't cast RGeo::Geographic::SphericalPointImpl to point