shitou's blog 

  • Home
  • About
  • Feed
  • 十人族
  • MIX BOY
  • 塌客

Category "ruby on rails"

24
Oct

几个rails tips

  • 在views和tests中都要使用helper的方法

  • 不要使用小的RJS文件,你可以把它直接放在controller中

  • 如果你使用RESTful的架构,不要在随便在你的action中使用respond_to来render xml,除非你真的使用了API

  • 如果你使用了在线支付和交易,不要存储它们在数据库中,直接把表单提交到支付网关

  • 在大多数情况下has_many :through比has_and_belongs_to_many要更好(shitou: 这样的话你就可以在关联表中添加更多的数据)

  • 你可以在model中通过关联来定义方法, e.g., has_many :visits do {define custom find here} end

  • 如果你的一个页面大部分都可以cached, 只是因为要显示登陆用户的用户名, 那么你可以直接使用page cache, 然后再用javascript来替换掉显示用户名的部分

  • 关掉不需要session的controller或者是action

  • decode一个session文件可以: Marsha1.load(File.read("/tmp/sessions/filename"))

 

翻译自: Tips from the Advanced Rails Studio

 

 

 

Tags: tips

2008-10-24 10:19:16, 748 reviews, comment

send to mailbox

Your email:

Related Posts

Performance Tuning for Linux Servers书笔记-Chap1

shell小技巧

Media change: please insert the disc labeled

在一个controller中调用另一个controller的方法

在cron中执行一个控制器的action

TOP

Tags

json Impactjs Canvas fun gen_server superfly PS3 Webgame HTML5 jquery SSH tenerer MooseFS gearman-ruby Gearman MongoDB MochiChat TCP U-ka saegusa IN db command Mai Kuraki Norah Jones log iPhoneException ACG Mac Safari objective-c CouchDB LVS AJAX debian 推荐 AMQP google mail bug gettext Erlang 北京 iptables 架构 tips mysql backup function 我看 postfix 监控 SEO cache Etag memcache thread 进程 线程 无锡 yield file column mixboy xml rss gems ruby shitou shell lighttpd 安全 csrf 公司 nginx linux 模块 apache webserver 朋友 大学 生活 尼古拉斯凯奇 movie 文件同步 笑笑 歌词 auto complete plugin rails music ubuntu blog

Category

  • HTML5[3]
  • iPhone[17]
  • Erlang[11]
  • google[13]
  • 生活[45]
  • 音乐[13]
  • 电影[11]
  • linux[29]
  • web server[6]
  • mail server[3]
  • cluster[1]
  • system manage[9]
  • ruby[20]
  • ruby on rails[28]
  • 开源[4]

Episode

  • MongoDB
  • MochiChat
  • iPhoneException
  • shell
  • thread
  • memcache


Popular Posts

  • 准备开始学习Erlang了(恶狼, 二郎..)
  • Ruby遍历MemCached的key
  • 服务器监控小脚本
  • MySQL Innodb备份
  • [转载]5个有用的ruby gems

Recommended Posts

  • Tri-survive - HTML5 Game
  • Cut the rope - HTML5版
  • json_formatter
  • 在gen_server中spawn新的进程
  • Superfly - Wildflowers
  • 继续凸墙 for Mac OS
  • MongoDB Beijing 2011
  • MongoDB删除map_reduce生成的tmp collection
  • Mai Kuraki - Future Kiss
  • Erlang OOP
  • 用SSH tunnel凸墙
  • Google的语法高亮工具包
  • 大量数据的批量操作
  • 再次被和谐-_-
  • 十人族: 上线了

Friends' blogs

  • levy
  • sphance
  • andreas
  • yangkunlun
  • {:dev=>:wxianfeng}
  • bheye
  • joeydarko

Login

   注册

留言 查看留言

留言

   取消

留言 查看留言


Statistics

  • 访问次数: 316244
  • 今天访问: 39
  • 日志: 213
  • 评论: 4967
  • 音乐: 9
  • 用户: 1758


少女,不点下广告吗!

 

all by shitou

blog comments powered by Disqus

close