Scaffold NoMethodError on Mac


Hello All:

I am still somewhat new to Rails but have created a successful app on a
Windows box and am venturing out for my first Mac Rails app. Being
relatively new to Macs as well, I believe I have a good install of the
latest versions (ruby, rails, mysql, webrick) but have hit two snags.

First - when I try to scaffold one of the controllers (i.e.
localhost:3000/mycontroller/new) just to check that my connection to the
db is good, I get the NoMethodError message in my browser. Everything is
set up right to the best of my knowledge, but it seems I am not making a
connection to the db. When I run the mycontroller/list page I get a lost
connection to the mysql database message. My database.yml file is
looking to localhost/port 3306. Maybe I am missing something…

Second - this was odd - but the Terminal would hang about part way
through the execution of:

ruby script/generate scaffold item

the generate model and controller scripts worked fine.

Any ideas?




For the Mac I used the following page for my installation:

And for installing lighttpd:

In your case maybe “sudo gem install mysql – --with-mysql-dir=/usr/
local/mysql” might already do the trick.

I’m keeping a blog on my own website.



Tom de Grunt wrote:


For the Mac I used the following page for my installation:

Thanks Tom, I’ll try it. But since I have a full install already in
place (via the hivelogic example) what would be the best way to remove
my current install and try again…assuming something is screwy with my
current installation?



/usr/local is not used by OSX under normal circumstances.
In my case PHP5 and MySQL5 are there and Lighttpd.

Maybe somebody knows whether “gem” can uninstall itself, perhaps ruby
can, using the
“make uninstall” in your src/ruby-1.8.4 folder (following the
Hivelogic example).

If both can not, you could go to /usr/local/bin and just remove or
rename the “ruby” and “gem” file there.

Did you run the “sudo gem install mysql – --with-mysql-dir=/usr/
local/mysql” bit?
You could also try and do “sudo gem uninstall mysql” and then try the
above command again.

If that does not work try putting a socket statement in your
database.yml, if that still does not work, I’m in the blue to as why.

Good luck!