fofof was useless
It’s always hard to kill your own code, but not killing it when you have to is worst in the long run. My idea for fof and consequently my gem fofof was useless. First I’ve discovered it didn’t work at...
View ArticleRedirecting back
It’s very common in Rails CRUD to have a create and update actions that redirect back to the show action. The idea is that you show an object, click edit, save, go back to showing said objects with...
View ArticleThe magic of Bundler
Recently I reported a bug for Formtastic. Justin French, the author of Formtastic, created a branch and made a fix. He then asked me for my feedback. I look at the code and then decided to give it a...
View ArticleMetaprogramming Ruby
http://rcm.amazon.com/e/cm?lt1=_blank&bc1=000000&IS2=1&bg1=FFFFFF&fc1=000000&lc1=0000FF&t=pupeno-20&o=1&p=8&l=as1&m=amazon&f=ifr&md=10FE9736YVPPT7A0FBG2&...
View ArticleAnother useful collection method? Enumerable#select_first
For a personal project I’m working on, I need to find out the smallest time period with more than 5 records. I essentially wrote this code: period = [1.week, 1.month, 1.year].select_first do |period|...
View ArticleRake tasks for production
When I need to run something periodically on production, I always implement it as a rake tasks and install it as a cron job. Nevertheless there’s some setup to do in the task to have proper logging and...
View ArticleCareful with that email
When you are building systems like my Keep on Posting or my DNSk9 that send emails there’s always the danger that you’ll accidentally fire emails from your development machine to real users. You really...
View ArticleGetting rid of RubyGems deprecation warnings
A recent update to RubyGems is causing a lot of deprecation warnings like these: NOTE: Gem::Specification#default_executable= is deprecated with no replacement. It will be removed on or after...
View ArticleFull URL in Rails’ logs
I find myself needing to have the full URLs in Rails’ logs. Normally you get something like: Started GET "/" for 127.0.0.1 at 2011-08-27 13:13:10 +0200 but I needed Started GET "http://foo.bar:3000/"...
View ArticleMaking your app work with no data
Most applications, web, desktop or mobile, handle some kind of data. When we are developing them we generally generate some sample data to play with and we forget to ever run the application without...
View ArticleMetaprogramming Ruby
http://rcm.amazon.com/e/cm?lt1=_blank&bc1=000000&IS2=1&bg1=FFFFFF&fc1=000000&lc1=0000FF&t=pupeno-20&o=1&p=8&l=as1&m=amazon&f=ifr&md=10FE9736YVPPT7A0FBG2&...
View ArticleAnother useful collection method? Enumerable#select_first
For a personal project I’m working on, I need to find out the smallest time period with more than 5 records. I essentially wrote this code: period = [1.week, 1.month, 1.year].select_first do |period|...
View ArticleRake tasks for production
When I need to run something periodically on production, I always implement it as a rake tasks and install it as a cron job. Nevertheless there’s some setup to do in the task to have proper logging and...
View ArticleCareful with that email
When you are building systems like my Keep on Posting or my DNSk9 that send emails there’s always the danger that you’ll accidentally fire emails from your development machine to real users. You really...
View ArticleGetting rid of RubyGems deprecation warnings
A recent update to RubyGems is causing a lot of deprecation warnings like these: NOTE: Gem::Specification#default_executable= is deprecated with no replacement. It will be removed on or after...
View Articlerandom_unique_id version 1.0.0 released
The core of random_unique_id was developed for Watu very early on, which means that it has been used in production for more than two years and a few thousands millions of records. It’s been released as...
View ArticleRun bundler-audit during testing
There’s a gem called bundler-audit that checks whether any of the gems in your project have open security advisors against them. A year or so ago there was an infamous month in which Rails itself got...
View ArticleShow a devise log in or sign up forms in another page
This is an update of an old post of similar name but for a newer version of Devise and with better design decisions. The old post was for Devise 1.0.8, this one covers 4.0.0 I was trying to have a...
View ArticleStoring SMTP credentials in secrets.yml in a Ruby on Rails Application
Rails 4.1 introduced the concept of secrets.yml, a file in which you store all the credentials for your app, separated by environment, so for example, development can talk to Test Stripe and production...
View ArticleLeft grouping label with Simple Form and Bootstrap 3
If you are using Simple Form and Bootstrap 3, you probably initialized your app with something similar to: rails generate simple_form:install --bootstrap which adds a file called...
View Article
More Pages to Explore .....