Skip to content
saberma edited this page Sep 26, 2011 · 2 revisions

开发指引

后台开发

内嵌Form属性

model中增加


accepts_nested_attributes_for :links

页面传递参数时,注意要使用 links_attributes 而不是links,否则会报错 ActiveSupport::HashWithIndifferentAccess
http://api.rubyonrails.org/classes/ActiveRecord/NestedAttributes/ClassMethods.html

前端开发

提高页面响应速度

请将以下内容加入 /etc/hosts ,以加快dns lookup时间

127.0.1.1 lvh.me checkout.lvh.me themes.lvh.me
127.0.1.1 smackaho.st shopqi.smackaho.st myshopqi.smackaho.st

调试


log 'some message'

后台管理操作后显示提示信息


msg '新增成功!'

规范

枚举值

放在 app/models/key_values.rb

操作用语

crud操作为新增、修改、删除,而不使用添加、编辑

迁徙脚本

表B只归属于表A,则将表B的迁徙脚本合并至表A
参考 db/migrate/20110417135410_create_link_lists.rb

Clone this wiki locally