getting an error `<main>’: undefined method `query’ for #<Mysql:0x00000100913e20> or sort (also for methods init, each etc’) are common for mysql ruby driver that is not installed correctly or without native extensions.

to fix this issue just run the following commands:

1. brew install mysql-connector-c

2. sudo gem install mysql — –with-mysql-lib=/usr/local/mysql/lib

(/usr/local/mysql/lib is my local mysql installation folder)

 

my stack is

rvm / ruby 1.9.2

gem 1.8.5

mysql  Ver 14.14 Distrib 5.5.12, for osx10.6 (i386) using readline 5.1 (64 bit dmg installation from mysql website)

mac 10.6.8

hope it helps .