Monthly Archives: February 2012

How to build your own gems

Gems are a pretty cool way to share ruby code. I have a lot of fun building my own gems. Here some details on what I did and a useful link to learn how to do the same..

From the RubyGem Guide:

Here the most important details you’ll need to make your gem:

First, start by creating an account on –

Let’s assume that your gem name is “my_totokudo”

Create your gem folder as follow:




my_totokudo.rb is in the subfolder “lib” of your folder “my_totokudo”

Your my_totokudo.rb contains the code of your gem and the gemspec usually contain the specification of your gems, here something you can copy and use. Make sure to edit it as per your need: do |s|        = 'my_string_extend'
  s.version     = '0.0.1'        = '2012-02-13'
  s.summary     = "Short summary"
  s.description = "Description of your gem."
  s.authors     = ["Your Name"]       = [""]
  s.homepage    = ""
  s.files       = ["lib/my_totokudo.rb"]

Before you install and push your gem you need to make sure that the name of your gem isn’t in use already:

$ gem list -r my_totokudo
Then you want to make sure that you have the last version of Rubygems installed:
$ gem update --system
Once you have all the specification of your gem and the .gemspec file ready you can build your gem. In the folder my_totokudo where the .gemspec is located Type:
$ gem build my_totokudo.gemspec

Then install it locally to test it if needed:
$ gem install ./my_string_extend-0.0.1.gem
to test it you'll have to prompt the testing command. Depending of your code and gem, what you may need to test it may varies. To launch the prompt type: 
$ irb --simple-prompt
Then require your gem:
>> require 'my_totokamo'
Do whatever test you need to do here. To exit the prompt type "quit".
Publishing your gem is very simple. You just have to type:
$ gem push my_totokamo-0.0.1.gem
And follow the instruction on the screen.  

If you build exciting Gems please share it with me by sending a mention and a link to your gem on twitter @Richardsondx

The most useful tutorials from to build a website from scratch

I love Ryan Bates’s website He is doing a great job sharing his knowledge and I am actively learning from it everyday since I started programming in Ruby on Rails. Here my personal list of most interesting tutorials I’ve found on it. I think anyone who already understand the MVC relationship and the differences between all type of variables on rails  can build an entire website just by watching, following and applying these tutorials instructions and tips.

– Pretty URL’s with FriendlyId – Episode #315

– Endless Page (revised) – Episode #114

– Paypal Recurring Billing – Episode #289

– ActiveAdmin – Episode #284

– Remember Me & Reset Password – #274

– Geocoder – Episode #273

– Trees with Ancestry – Episode #262

– Authentification from Scratch – Episode #250

– Notifications in Rails 3 – Episode #249

– Charts – Episode #223

– Subdomains in Rails 3 – Episode #221

– Mobile Devices – Episode #199

– Declarative Authorization – Episode #188

– Controllers in Rails 3 – Episode #224

– Routing in Rails 3 – Episode #203

– Validation in Rails 3 – Episode #221

– Nested Model Form Part 1 – Episode #196

– Nested Model Form Part 2 – Episode #197

– Formstatic Part 1 – Episode #184

– Formstatic Part 2 – Episode #185

– Cropping Images – Episode #182

– 7 Security Tips – Episode #178

– Pagination with AJAX – Episode #174

– Integrating Active Merchant – Episode #145

– Paperclip – Episode #134

– Beta Invitations – Episode #124

– Site Wide Announcements – Episode #103

– HTTP Basic Authentication – Episode #82

– Sending Email – Episode #61

– Restricting Access – Episode #20