Archive by Author

How to resolve the rmagick.rb:248: [BUG] Segmentation fault issue

The way I resolved the following rmagick.rb:248: [BUG] Segmentation fault issue was by reinstalling the ImageMagick and the rmagick gem. When reinstalling imagemagick, you should disable openmp. See below. Source: http://stackoverflow.com/questions/7319445/rmagick-leads-to-server-shutdown:

ckeditor $ is not defined

ckeditor gem assumes that you load your JavaScripts at the top of your page instead of the bottom. I used the SimpleForm integration by setting the textarea input field parameter to :as => :ckeditor which inserts the following code beneath your textarea: However, if you load your JavaScript at the bottom of the page instead […]

Facebook Share and Like Button Customization Issues

My goal was to get a customized Facebook Like button working. Our designer gave us a mockup of a Facebook button which didn’t have the word Like in it, no counter or anything else except the f in a rounded-corner box Facebook logo. It was very difficult to customize it since code you insert into […]

String datatype usages

‘ ‘ ” ” %q( ) – matches with single-quote but you can choose %Q| | – like double-quote but you can choose end chars doc =

Rails 3 Performance

Great article on Rails 3 performance Rails 3 Performance – Not Good Enough

Rails and rake db:migrate in Production Mode

There are some inconsistencies when running rails server, rails console and rake db:migrate in production mode. There really should be a standard way to let the rails and rake commands know you want to execute them in production mode. Starting Rails Server in Production Mode Starting Rails Console in Production Mode rake db:migrate in Production […]

Clearing All Rails Log Files with Rake Task

In order to clear all of your Rails log files development.log, production.log, server.log and test.log with a rake task, type: This is mainly useful while under development. Be careful with this as it will clear out your production.log file as well!

Building Custom XML Responses in Rails

Assume you have a CitiesController with just one action capital_city, which doesn’t need any of the RESTful actions. I set up a custom route for this one action. The capital_city action returns the xml like the following, for example: Here is what the entry in the routes.rb file looks like: Your controller may look something […]

Bundle Install – missing mysql.h

If you’re seeing the following error: The way I was able to resolve it was to follow Boonedocks.net, since I’m also using MAMP for its MySQL Database instance. The only difference is that I already had MAMP 1.9.4 installed and so I had to download the MAMP_components_1.9.dmg which contains the mysql-5.1.44 source code. MAMP 1.9.4 […]

Using lambda with named scopes in Rails 3

You can define an ActiveRelation named scope inside your model Address, for example, like so: