Blog信息 |
blog名称: 日志总数:1304 评论数量:2242 留言数量:5 访问次数:7593093 建立时间:2006年5月29日 |

| |
[Ruby on Rails]ActionRecord和ActionPack 配置 软件技术
lhwork 发表于 2007/1/19 15:59:42 |
ActionRecord 配置 整理出来方便查询 1.ActionRecord:Base.logger=logger 接受一个logger对象。改对象被内部使用。用于记录数据库的操作。如果应用程序须记录数据库操作,也会使用这个logger对象。 2.ActionRecord:Base.primary_key_prefix_type=option 如果option为nil.则所有表的缺省主键字段都是id,如果改选项值为:table_name,则会在"id"前面加上表名,如果改选值为: table_name_with_underscore,则会在表名与id之间以下画线分隔。 3.ActionRecord:Base.table_name_prefix="prefix" |
|
[Ruby on Rails]Rails: Inner joins by association names 软件技术
lhwork 发表于 2007/1/19 15:58:55 |
From http://habtm.com/articles/2006/05/10/inner-joins-by-association-names:
We can enjoy eager loading with association names.
代码
Member.find(:all, :include=>[:group, :profile])
render_code();
But :joins option forces us to write raw |
|
[Ruby on Rails]Rails代码片段 软件技术
lhwork 发表于 2007/1/19 15:57:25 |
1Debugging Views in Development
ruby 代码
<!--javascript_include_tag 'prototype'-->
<!--/span><span class="keyword">if</span><span>&nb |
|
[Ruby on Rails]Ruby线程池 软件技术
lhwork 发表于 2007/1/19 15:56:12 |
This is useful for a variety of scenarios. You create a thread pool, give it a maximum size, and pass a block to it everytime you need something processed. If all threads are busy, you block until a thread becomes free.
For example:
代码
pool = ThreadPool.new( |
|
[Ruby on Rails]一个非常不错的缓存方法,把缓存的结果放在数据库,节省内存!(转) 软件技术
lhwork 发表于 2007/1/19 15:55:27 |
http://www.bigbold.com/snippets/posts/show/3286Rails memcached is not very easy to introduce to a large rails installation. Memcached also chews up a lot of memory on the box and overall cached model does not work the way I needed it to. Basically, I have just a “few” queries that I needed to cache because pagination su |
|
[Ruby on Rails]Rails 命令大全 软件技术
lhwork 发表于 2007/1/19 15:54:19 |
一.铁道 1.1 创建一个Rails应用程序 $ rails app_name 可选项: -d, database=xxx 指定安装一个数据库(mysql oracle postgresql sqlite2 sqlite3 ), 默认情况下是数据库 -r, ruby-path= 指定Ruby的安装路径,如果没有指定,scripts使用env去找Ruby -f, freeze (冻结)freezes Rails在vendor/rails目录 1.2 API Documentation $ gem_server 启动一个WEBrick服务器。这时候你可以通过Http://localhost:8808/ 打开浏览器去查看rails API文档 1.3 Rake rake db:fixtures:load # 载入fixture |
|
|