Quantcast
Channel: Ruby on Rails – Pablo Fernandez
Browsing all 28 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

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 Article



Image may be NSFW.
Clik here to view.

Redirecting 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 Article

Image may be NSFW.
Clik here to view.

The 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 Article

Image may be NSFW.
Clik here to view.

Metaprogramming 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 Article

Image may be NSFW.
Clik here to view.

Another 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 Article


Image may be NSFW.
Clik here to view.

Rake 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 Article

Image may be NSFW.
Clik here to view.

Careful 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 Article

Image may be NSFW.
Clik here to view.

Getting 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 Article


Image may be NSFW.
Clik here to view.

Full 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 Article


Image may be NSFW.
Clik here to view.

Making 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 Article

Image may be NSFW.
Clik here to view.

Metaprogramming 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 Article

Image may be NSFW.
Clik here to view.

Another 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 Article

Image may be NSFW.
Clik here to view.

Rake 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 Article


Image may be NSFW.
Clik here to view.

Careful 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 Article

Image may be NSFW.
Clik here to view.

Getting 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 Article


Image may be NSFW.
Clik here to view.

random_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 Article

Image may be NSFW.
Clik here to view.

Run 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 Article


Image may be NSFW.
Clik here to view.

Show 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 Article

Image may be NSFW.
Clik here to view.

Storing 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 Article

Image may be NSFW.
Clik here to view.

Left 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
Browsing all 28 articles
Browse latest View live




Latest Images