Handling exceptions is really important. I wrote a short post on how to handle reentrancy and other failures in Sidekiq workers: Adding reentrancy and a on failure fallback for your Sidekiq workers
mencio — 42 posts
If you implemented your own authentication engine, you can still move to Devise. Even when you have a custom encryptor that needs to stay. Here's an article on how to do it
ActiveRecord count vs length vs size and what will happen if you use it the way you shouldn’t dev.mensfeld.pl
One of the most common and most cumbersome errors you can make: using length instead of count. You can repeat this multiple times, but you will always find someone who’ll use it the way it shouldn’t be used. Here as a reminder: ActiveRecord count vs length vs size and what will happen if you use it the way you shouldn’t
Ruby & Rails: Making sure rake task won’t slow the site down dev.mensfeld.pl
If you don’t have multiple cores and/or you have a small VPN, you may end up with a huge slow down of your web app, when rake tasks are executed. This can be a big issue especially when you use something like whenever to perform periodic tasks. Luckily there’s a nice. You can read more about how to use it here: Ruby & Rails: Making sure rake task won’t slow the site down
Installing Rhodes on Ubuntu and making it run on Ruby 2.1 dev.mensfeld.pl
When you want to write a mobile app, but you don't want to quit Ruby, it's worth looking into Rhodes. Unfortunately it might not be so simple to use it on Ubuntu (or any other Linux). Also it won't work out of the box with anything newer than 1.9.3. I wrote a simple how to bypass all of those issues: Installing Rhodes on Ubuntu and making it run on Ruby 2.1
Running GitLab 7.1 using Puma instead of a Unicorn dev.mensfeld.pl
Theoretically it is not recommended but on the other hand, sometimes you just have to do some things not as they were described in a default tutorial. Here's a description of how to run GitLab 7.1 using Puma instead of a Unicorn.
Nginx (and Puma behind) maintenance mode for Rack/Rails applications with Capistrano dev.mensfeld.pl
There is a time, when we need to switch our apps into maintenance mode. Maybe it is because of some data processing stuff, maybe because of backups, deployment or whatever good reason you might have. To be honest it doesn’t matter why. What does matter, is how we should handle working users of our apps. In this article I describe how to setup an automatic maintenance page that will show during each Capistrano deploy. Nginx (and Puma behind) maintenance mode for Rack/Rails applications with Capistrano
ActiveResource relations – a bit of magic to make it look and feel more like ActiveModel relations dev.mensfeld.pl
ActiveResource can be pretty helpful when you have a RESTful JSON API. Although it has some limitations. One of the most irritating is a lack of nested resources #new scope method. Luckily there's a way to make it work exactly as its ActiveRecord equivalent. For more details, plese refer to this post: ActiveResource relations – a bit of magic to make it look and feel more like ActiveModel relations
Tracking Sidekiq workers exceptions with Errbit/Airbrake dev.mensfeld.pl
A quick hint for all those that think that it comes by default with Errbit/Airbrake. Tracking Sidekiq workers exceptions with Errbit/Airbrake
Blog post about Sidekiq. How to use it with multiple apps on the same server: Multiple Sidekiq processes for multiple Rails/Sinatra applications – namespacing
Testing Sinatra application methods in isolation with RSpec dev.mensfeld.pl
A small blog post on how to test Sinatra application methods, without having to perform full requests. More isolation easier. Testing Sinatra application methods in isolation with RSpec
Ruby programmer - why Y U no code quality? dev.mensfeld.pl
Few words about documentation, code quality and costs that you can have, when you don't care about stuff like this. More in my article: Ruby programmers/project managers/CEOs Y U NO enforce code quality?
Ruby (Rails, Sinatra) background processing – Reentrancy for your workers is a must be! dev.mensfeld.pl
I just wrote a post about reentrancy for background workers. Want to know, why it's worth having reentrant workers (or what does it mean)? You can check out my blog post: Ruby (Rails, Sinatra) background processing – Reentrancy for your workers is a must be!
Upgrading to Rails 4.1 from Rails 4.0 dev.mensfeld.pl
I wrote a post on how to upgrade your Ruby on Rails app from Rails 4.0 to Rails 4.1. It's not so hard as I first though it would be: Upgrading to Rails 4.1 from Rails 4.0 – Ruby on Rails.
How to crash a lot of Rails apps - Invalid Byte sequence in UTF8 dev.mensfeld.pl
I wrote a short blog post on how to crash many Rails/Rack based apps. Not a big deal and not a security issue, but still worth patching: Rack: ArgumentError: invalid byte sequence in UTF-8
Mongoid and Aggregation Framework: Get similar elements based on tags, ordered by total number of ma dev.mensfeld.pl
Sometimes using unwind can be really useful. Here's an example on how to get similar documents, based on number of equal tags that they have: Mongoid and Aggregation Framework: Get similar elements based on tags,
Maybe instead of one database it is worth using one per user? Well in case of MongoDB it seems that it is definitely worth a try. Check out my short blog post about that: http://dev.mensfeld.pl/2014/01/using-multiple-mongodb-databases-instead-of-one-performance-check/
How to have a Devise remember_me option set to true by default dev.mensfeld.pl
Let's be honest, users don't want to authenticate each time they open an app. Obviously we can't do this for all applications due to security reasons, but there are some, that can benefit from having such feature. Here's a short description on how to obtain it with Devise authenticating engine.
Downloading files with Open-Uri and saving it using Paperclip dev.mensfeld.pl
Sometimes it is worth having files/images that were embedded into comments/etc on your own server. Here's an easy way on how to do it.
Rails + CoffeeScript + Jquery – Marking multiply objects for destruction at a time (frontend) dev.mensfeld.pl
Sometimes it's hard to figure out simple things. This post is exactly about this: how to mark multiply nested objects for destruction in Rails forms using CoffeeScript and Jquery filter method.
Stubbing Paperclip/ImageMagick to make specs run faster, but with image resolution validation dev.mensfeld.pl
You want to speed up rspec paperclip, but you still need image resolution validations, so Quickerclip is not an option? Take a look here: Paperclip and Rspec: Stubbing Paperclip/ImageMagick to make specs run faster, but with image resolution validation
Revert change on ActiveRecord::Relation#order method monkey patch to keep Rails 4.0.0 order behaviou dev.mensfeld.pl
Did you like the Rails 4.0.0 ActiveRecord#order behaviour? Well it's going to dissapear soon. If you're interested about the reasons and you want to keep it for a bit longer - it's worth looking at my post:
Revert change on ActiveRecord::Relation#order method monkey patch to keep Rails 4.0.0 order behaviou
Revert change on ActiveRecord::Relation#order method monkey patch to keep Rails 4.0.0 order behaviou
How to use Ransack UI helpers with Mongoid on Rails 4.0 dev.mensfeld.pl
I just posted a note on how to use Ransack fancy UI helpers along with Mongoid on Rails 4.0. If you're looking for a way to do this, than it might be helpful: How to use Ransack helpers with MongoDB and Mongoid on Rails 4.0.
Second part of my tutorial on how to update from Rails 3.2 to Rails 4.0. You can check it out here: Upgrading to Rails 4.0 from Rails 3.2 – Test case – Part II (assets, models)
Upgrading to Rails 4.0 from Rails 3.2 – Test case – Part I (preparations, configuration, gems) dev.mensfeld.pl
I just wrote a first part of a tutorial on how to update you Rails application from Rails 3.2 to Rails 4. You can check it out here: Upgrading to Rails 4.0 from Rails 3.2 – Test case – Part I (preparations, configuration, gems).
Jenkins behind Apache with HTTPS – Proxy pass with SSL dev.mensfeld.pl
If you want to know how to proxy pass Jenkins with Apache and add a SSL to it all, you should read this post.
I just wrote a tutorial on how to create a maintenance page for Passenger hosted Rails application and manage it with Capistrano tasks. You can check it our here: Apache (Passenger) Maintenance mode for Ruby on Rails application with Capistrano
Paperclip, Bootstrap and SimpleForm working together on Rails dev.mensfeld.pl
I just wrote a post about integrating Paperclip with Bootstrap and SimpleForm without the need for f.error elements. In my opinion this approach is way more cleaner that the basic one. You can check it out here: Paperclip, Bootstrap and SimpleForm working together on Rails
Do you need to clear Memcached instance without restarting it? If you do - check this post.
Compressing large data sets in Redis - Ruby test case dev.mensfeld.pl
A just wrote a post about my attempt to decrease Redis memory consumption by Gzipping the data that I was having there. Wanna see how it ends? Click here: Compressing large data sets in Redis - Ruby test case.
Using MongoDB to store and retrieve CSV files content in Ruby dev.mensfeld.pl
Post about loading dynamic CSV/XML data to MongoDB using Ruby and Mongoid gem. Check it out!.
Simple Ruby(Rails) Passenger memory consumption limit monitoring dev.mensfeld.pl
Sometimes Passenger gets really naughty and grows rapidly, eating all available memory. I just wrote a post on how to protect our apps and servers from such problems. You can check it out in post titled: Simple Ruby(Rails) Passenger memory consumption limit monitoring
ERR unknown command blpop for Resque, Redis and Rails dev.mensfeld.pl
I just posted small note on how to fix "unknow command blpop" for Resque, Redis nad Rails. You can check it out here.
Making Redis-store views cache work with simple Regexps dev.mensfeld.pl
I've found a way to make Redis-store work with simple Regexps and also expire caches with wirdcard string (once that hit Redis Keys method). Check this out!
Blog post about fixing the "You need to install ruby-debug to run the server" message when trying to use RVM, Ruby 1.9.3 and Ruby debugger.
I just found an easy way to extend and overwrite bb-ruby bbcode gem translations in Ruby on Rails. This allows you to implement your own rules really easily. Check it out!.
I just posted an article about using Redis as a temporary cache for data shared by multiple independent processes.
Creating own small ruby integration server – Part 2 – Handling Rubies and gemsets management easier dev.mensfeld.pl
Handling Rubies and gemsets management easier - second part of my tutorial about building from scratches small integration server for development purpose.
Creating own small ruby integration server – Part 1 – RVM Ruby version management directly from Ruby dev.mensfeld.pl
I just started creting own small Ruby integration server software here and I've decided to make tutorial out of it. Check it out.