No source for ruby-1.9.3-p484 provided with debugger-ruby_core_source gem

I was getting this error when the ruby version is updated to 1.9.3-p484. When you’re using RVM, the solution is quite simple. Install the gem with the following command:

gem install debugger-linecache -v '1.1.2' -- --with-ruby-include=\$rvm_path/src/ruby-1.9.3-p484

If you need to install different version of debugger-linecache change 1.1.2 with appropriate version. If the you’re using different ruby version, change ruby-1.9.3-p484 to appropriate value.

KnockoutJS Starter

KnockoutJS Starter

I received the paperback of KnockoutJS Starter book on 28th  December, 2012 though I’ve already completed many pages reading its PDF version. I could not publish my review as I was little busy with our Ruby Conference in Bangladesh.

KnockoutJS Starter is written by Eric M. Barnard and is published by Packt Publishing. This is a very short book which can be completed reading within a week or two.

Continue reading →

Replace Rails confirm dialog with Bootboxjs

Today, I wanted to use Bootboxjs wonderful alert, confirm box in a project. Though it’s pretty easy to use separately, I, later, wanted to replace Rails default confirm dialog box with the same of bootboxjs. Rails default confirmation box is shown by its built in unobtrusive UJS library. At first, lets see how that works.

link_to 'Destroy', @post, :confirm => 'Are you sure?',:method => :delete, :class => 'btn btn-mini btn-danger'

This will generate markups that looks like:

<a class="btn btn-mini btn-danger" href="/posts/999" rel="nofollow" data-confirm="Are you sure?" data-method="delete">Destroy</a>

Now, when you click the Destroy link, it will first ask you with message “Are you sure?”. If you press “Ok” only then it will proceed. So, you get this confirmation box free :).

However, we are seeing this same confirm dialog for years after years and it’s too boring. I wanted to replace this using bootboxjs sexy dialog boxes that is based on Twitter Bootstrap. I’m already using twitter bootstrap for my project so I’m actually not adding that much overhead. You can include it easily using Twitter Bootstrap Rails gem.

When I wanted to override Rails confirm box, I found the a Gist that worked nicely out of the box.

Continue reading →

Ruby Under a Microscope

Finally, I’ve started reading the book Ruby Under a Microscope written by Pat Shaughnessy. I was eagerly waiting for this book for quite long time. When it released recently, I saw that I can’t buy it using PayPal. I emailed the author asking how can I pay using PayPal. To surprise me most, the author sent me a copy of the book with the reply email. I guess, he could feel my interests to read this book. I can’t be more happy.

I’ve just started reading it and yet to complete the first chapter. I am loving what I’m reading. I’m feeling indebted to Ruby seeing how far it goes with my written codes :-). I had no idea that, internally, it cares so much about my code and does so many things before returning me what I expect.

Continue reading →

Ruby and MongoDB Web Development Beginner’s Guide Review

I remember the days when I’ve used MongoDB  in simple Ruby on Rails (RoR) project using Mongoid. It’s so simple to use MongoDB with RoR without knowing much about it. While using MongoDB, as a project requirement, I became more interested about it and decided to dig more. The moment I wanted to learn more about it, I found the book Ruby and MongoDB Web Development written by Gautam Rege. Thank goes to my colleague Rubayeet Islam, who suggested me this book. When I started reading it, I started feeling at home as I’ve already familiar with several Ruby/Rails/MongoDB concepts that I’ve learned during my works. However, here is my overall feelings about the book.

The first four chapters of the books talks solely about MongoDB. You will learn how to install it, run it, query it, use complex queries etc. and all of these using the default mongodb client.

Continue reading →

Beginning Ruby From Novice to Professional

Beginning Ruby
I used to review books a bit detail. I include as much information as much possible and make senses. However, I’m going to make an exception this time. I will write a quick review on the book titled Beginning Ruby, From Novice to Professional authored by Peter Cooper published by Apress. The exception that I’ve just mentioned is that this review will be my shortest book review ever.

I’ve started by Ruby journey in a reverse way. First I’ve started working with Ruby on Rails directly (But I’ve read these tutorial to get basic idea). When I’ve found it’s fun, I started learning Ruby following this book.

The only thing I can tell about this book is “This is the one of the best book, of its kind, I’ve ever read”. So, If you want learn Ruby, you can consider this book without any second thoughts. That’s all about my review :).

Rails options_from_collection_for_select with custom attributes for each option

You probably already know that you can use options_from_collection_for_select helper method generate <option></option> from a collection. If you are unaware of it, you can check this api documentation.

It helped me greatly until I needed some custom attributes to each <option></option> which will be used by jQuery for doing some tasks in UI level. Custom attributes will help me by reducing server calls for getting those information. However, I did not find a way set custom attributes with the above helper method. So, I’ve made a basic version of my own (if you prefer, you can override the original method). Put the following method in your helper file (may be in application_helper.rb).

Continue reading →

SSL/OpenSSL issue with Ruby 1.9.3

After upgrading to Ruby 1.9.3x, I was totally unable to use SSL. Even i could not run ‘bundle install’ when i was using ‘’ as the source. It was showing a multi-page error messages starting with something like ‘segmentation fault’. For the time being, i’ve used ‘http’ rather than ‘https’ for the url. However, it did not solve other problems.

While googling about it, i found many suggestions and i’ve screwed my OS (Mac OSx) OpenSSL. However, i’ve found a simple solution. It was just two lines of command if you are, like me, using RVM to managing Rubies.

First of all, you need to install openssl package using rvm. So run

$ rvm pkg install openssl

It will install openssl in your rvm path usually .rvm/usr under your home (~) directory.

Now, you need to reinstall your current ruby version (you can also install a newer version if you want) mentioning the path of the OpenSSL.

$ rvm reinstall 1.9.3 --with-openssl-dir=$rvm_path/usr

If you want to install a new version, you should use ‘install’ rather than ‘reinstall’.

That should solve your problem. If not, my sympathy goes for you. Good luck googling!

Rails scaffold, create .haml rather than .erb views

After being tired of refactoring .erb files to .haml I headed for a way to modify the rails generator that will create .haml view files rather than .erb view files.

After a while, I found what exactly I needed. ‘haml-rails’ is the name of the solution. This is how you do it.

Add the following line to your Gemfile:

gem 'haml-rails'

Then run the bundler (bundle install).

Now append the following lines in your application.rb file (at the end of Application class):

config.generators do |g|
   g.template_engine :haml

That’s it. Your new scaffolds will generate .haml files (and obviously haml syntaxes) for you.

This is much easier than Haml-scaffold.