Generating CPFs + Factory Girl


If you want to make a Factory and in your factory you have a Brazillian CPF number, you can do this:

1)Use the gem CPF Faker

2) Using

require 'cpf_faker'

FactoryGirl.define do
   factory :user do
        cpf {Faker::CPF.numeric}
        sequence(:nome) {|n| "Nome_#{n}"}
        sequence(:email) {|n| "Nome_#{n}"}
        sequence(:password) {|n| "senha_#{n}"}


Installing rmagick (2.13.1) with native extensions – Problem!



Installing rmagick (2.13.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/Users/yourUser/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5… yes
checking for clang… yes
checking for Magick-config… yes
checking for ImageMagick version >= 6.4.9… yes
checking for HDRI disabled version of ImageMagick… yes
checking for stdint.h… *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Solution(Mac OS X Lion):

brew remove imagemagick 
brew install imagemagick --disable-openmp --from-source
bundle install

Possible problems with rails + mysql on OS X Lion


If you are trying to run your app with Rails and you got some errors when execute the rake db:migrate It is possible that you must to install the GCC. In Lion installation there is no gcc default. You can check GCC here:

Other possible error is the lack of a  symbolic link:

( Library not loaded: libmysqlclient.18.dylib )

ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib

With these changes you may run successful the mysql + rails in your app.

Remembering that is a good practice to reinstall your gem after these changes:

gem uninstall mysql2

bundle install