以前一直很懒,很少出去转转,最新心情大好,尤其ubuntu11的安装和win7装双系统非常简单,就没事到liunx下转转
这几天一直折腾ruby on rails 如何配置 如何链接mysql,如何安装插件,郁闷的要死,才发现微软的一站式技术服务时多么的周到
看了几天ruby,发现有不少值得借鉴和学习,至少我是这么觉得
我觉得ruby or rails 就是吧一些常规的经验 固定化,写死,这样就不容易出现变化,不容易出错
首先看看rails创建的文件目录
第一个是ruby的目录
第二个使用neabeans打开
第三个是vs2010创建的mvc
我比较了一下,asp.netmvc的 目录少了很多,当然,也可以说.net崇尚简约
哪ruby多了什么呢?
首先,多了一个log文件,经过我测试,rails会把出错日志写进去
格式如下
Started GET "/assets/rails.png" for 127.0.0.1 at 2011-11-12 18:57:40 +0800 TypeError (can't convert Fixnum into String): Rendered d:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_trace.erb (2.0ms) Rendered d:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (2.0ms) Rendered d:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (19.0ms)
虽然比较简单,可能每一个请求都记录了,这就是我认为将经验固定化的表现,要知道哪一个系统的log都是必须的而.net的log需要自己实现,也有一个不错的log4net,但是我学习.net3年后才知道的,
其他的我也没多看,毕竟接触时间,在ubuntu上找个文件都不会,羞死人了
代码如下
# MySQL. Versions 4.1 and 5.0 are recommended. # # Install the MYSQL driver # gem install mysql2 # # Ensure the MySQL gem is defined in your Gemfile # gem 'mysql2' # # And be sure to use new-style password hashing: # http://dev.mysql.com/doc/refman/5.0/en/old-client.html development: adapter: mysql2 encoding: utf8 reconnect: false database: depot_development pool: 5 username: ****** password: 123456 host: localhost # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: adapter: mysql2 encoding: utf8 reconnect: false database: depot_test pool: 5 username: ****** password: 123456 host: localhost production: adapter: mysql2 encoding: utf8 reconnect: false database: depot_production pool: 5 username: ****** password: 123456 host: localhost
rails 强制性的将开发环境氛围 开发式 测试式 产品式,也就是以产品的流程来做框架的,大家挂在嘴边的一句话就是“我那里好好的,到你这里怎么这样了,无语啊,人品问题”,无他,环境不同而已
test