Linux 下 Ruby On Rails(ROR)学习

1.遇到的第一个错误:

undefined method `render_text' for #<MytestController:0xb5df2eb4>

undefined method `render_text' for #<MytestController:0xb5df2eb4>
 


     从网上查到的解决方法:

     现在rails不用render_text "Hello World"了,改成了:

render:text=> "hello world"
 

2.创建数据库时错误:

Couldn't create database for {"encoding"=>"utf8", "username"=>"root", "adapter"=>"mysql", "database"=>"mybook_development", "pool"=>5, "password"=>nil, "socket"=>"/var/run/mysqld/mysqld.sock"}, charset: utf8, collation: utf8_general_ci (if you set the charset manually, make sure you have a matching collation)
 

    解决:

    在网上查了一下,原来是没有权限访问数据库。因为默认生成的数据库配置信息中的password字段没有设置。简单的设置该字段之后问题解决。 

猜你喜欢

转载自zzgthk.iteye.com/blog/737506