浏览 2559 次
该帖已经被评为新手帖
|
|
---|---|
作者 | 正文 |
发表时间:2007-02-02
當我用rake migrate 這個指令沒有問題 可以create table 在mysql 上 可是當我使用 ruby script/console 的時候 >> photo=photo.new NoMethodError: You have a nil object when you didn't expect it! The error occurred while evaluating nil.new from (irb):1 卻產生問題 我試著去用 gem install mysql -- --with-mysql-dir=/usr/local/mysql 在make 時會發生error Select which gem to install for your platform (i686-darwin8.8.2) 1. mysql 2.7.3 (mswin32) 2. mysql 2.7.1 (mswin32) 3. mysql 2.7 (ruby) 4. mysql 2.6 (ruby) 5. mysql 2.5.1 (ruby) 6. Cancel installation > 3 Building native extensions. This could take a while... gcc: installation problem, cannot exec `cc1': No such file or directory make: *** [mysql.o] Error 1 gcc: installation problem, cannot exec `cc1': No such file or directory make: *** [mysql.o] Error 1 ruby extconf.rb install mysql -- --with-mysql-dir=/usr/local/mysql checking for mysql_query() in -lmysqlclient... no checking for main() in -lm... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lz... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lsocket... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lnsl... no checking for mysql_query() in -lmysqlclient... no make gcc -I. -I. -I/usr/lib/ruby/1.8/i686-darwin8.8.2 -I. -DHAVE_MYSQL_SSL_SET -DHAVE_MYSQL_H -I/usr/local/mysql/include -fno-common -g -O2 -pipe -fno-common -c mysql.c make install gcc -I. -I. -I/usr/lib/ruby/1.8/i686-darwin8.8.2 -I. -DHAVE_MYSQL_SSL_SET -DHAVE_MYSQL_H -I/usr/local/mysql/include -fno-common -g -O2 -pipe -fno-common -c mysql.c Successfully installed mysql-2.7 雖然最後有出現成功的訊息 但是使用console時 還是無法使用 請問該如何解決呢 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2007-02-02
你直接下载mysql 安装不就可以了。
装好mysql 配置 rails config下面的database.yml,设置好连接数据库的用户名,密码, rails就可以自动访问 |
|
返回顶楼 | |
发表时间:2007-02-02
ouspec 写道 你直接下载mysql 安装不就可以了。
装好mysql 配置 rails config下面的database.yml,设置好连接数据库的用户名,密码, rails就可以自动访问 是的 mysql我已經裝好了 rails也可以連結 schema mirration 可以用 只是我想知道 為啥使用 ruby script/console 時 為啥無法使用 會有問題 不知道有沒有可以為我解答一下 |
|
返回顶楼 | |
发表时间:2007-02-02
我真是笨
我自我解答一下 因為在使用 photo=photo.new 錯誤 應該要用大寫 photo=Photo.new 一時不察 真笨 |
|
返回顶楼 | |