ruby 到 rails

1. ruby和数据库的连接

ruby的贡献者实现了很多连接外围数据库的interface,大都基于C。即在DHH之前,这些库已经存在。连接到oracle、通过ruby的接口有许多,目前OCI8占优。它们实现了类似jdbc的功能。

 

2. ActiveRecord

Rails and Active Record are both projects conceived by DavidHeinemeierHansson and improved upon by a number of Contributors.(http://wiki.rubyonrails.org/rails/pages/ActiveRecord )

ActiveRecord是ruby中一个独立的ORM lib,DHH也将其作为rails中的model 部分。

 

 

写道
The library for Ruby is named after Martin Fowler's "Active Record" design
pattern. In essence, it ties database tables to classes so that the data can be manipulated
intuitively without SQL. To be more specific, it "wraps a row in a database table or view,
encapsulates the database access, and adds domain logic on that data"


The ubiquity of both these models (RDBMS and OOP) and the "impedance mismatch" between
them has led many people to try to bridge this gap. The software bridge that accomplishes
this is called an Object-Relational Mapper (ORM).

 

3. fastCGI和lighttpd

Apache实现fcgi的插件有问题,所以不能使用来搭配rails(知道不能是fcgi的方式)。

lighttpd的配置备忘。

要用Apache只能低于1.3版本,因为apache的fcgi对应插件在04年就停止开发,1.3之后的版本都有兼容性问题。

server.error-handler-404 = "/dispatch.fcgi"

这句话使得可以把动态资源定向到ruby的fcgi进程。

 

 

############ BEGIN HIGHLIGHT ##################
fastcgi.server = ( ".fcgi" =>
    ( "localhost-8000" => ( "host" => "127.0.0.1", "port" => 8000 ) , 
    "localhost-8001" => ( "host" => "127.0.0.1", "port" => 8001 ) ,
    "localhost-8002" => ( "host" => "127.0.0.1", "port" => 8002 ) )
)
############ END HIGHLIGHT ##################


cgi是每次启动一个进程来执行脚本,执行完毕返回结果后消除进程。fcgi是把请求分发给某个事先跑起来的进程,执行完毕后进程进入后续队列。

疑问是cgi这种运行方式怎么会产生的,而且还存在了那么多年。



 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值