<body>

Caiwangqin's blog

Focus on Web2.0, Business, Architecture, Agile, Technic and beyond…

积木式网站建设

2007年3月16日 星期五


Ruby on Rails让做网站像搭积木一样简单,例如使用acts_as_commentable的方法如下:


* Make you ActiveRecord model act as commentable.
class Model < ActiveRecord::Base
    acts_as_commentable
end
* Add a comment to a model instance
model = Model.new
comment = Comment.new
comment.comment = ‘Some comment’
model.comments << comment
* Each comment reference commentable object
model = Model.find(1)
model.comments.get(0).commtable == model



Plugins:


http://agilewebdevelopment.com/plugins/list


Useful code snippets in Ruby and Ruby on Rails



标签:

posted by Caiwangqin, 上午11:41

<< 主页