每天一剂Rails良药知识库


最近更新文章

Rails宝典之第二十四式: Stack Trace

这次讲的是一个textmate plugin textmate_footnotes,用来当Rails程序页面出错时可以点击Stack Trace链接去到 Rails程序源码甚至Rails源码中。 No use for no Mac guys. -_-!
hideto 评论 (0) 有 1260 人浏览 2011-05-26

Rails宝典之第二十三式: counter cache

请看Rails里的Magic Column Names 这次就是讲用_count字段来缓存has_many的计数 看Project和Task的例子: <h1>Projects</h1> <table> <% for project in @projects %> <tr> <td><%= link_to projec ...
hideto 评论 (0) 有 1586 人浏览 2011-05-26

Rails宝典之第二十二式: eager loading

看这个页面代码: <% for task in @tasks %> <%= link_to task.name, task_path(task) %> in <%= task.project.name %> <% end %> 上面的代码对每个task对象,取得project的name属性并显示,看看log: Project Lood (0.00 ...
hideto 评论 (0) 有 1391 人浏览 2011-05-26

Rails宝典之第二十一式: 超级简单的认证

续上一节。 我们知道Acts as Authenticated、restful_authentication等许多插件,我们这里为了开发方便也可以简单实现admin?方法: def admin? @current_user.name == "admin" end # or def admin? session[:password] == "foobar" ...
hideto 评论 (0) 有 1149 人浏览 2011-05-26

Rails宝典之第二十式: 限制访问

续上一节。 我们在页面中加上如下代码来限制public访问: <!-- episodes/index.rhtml --> <% if admin? %> <%= link_to 'New Episode', new_episode_path %> <% end %> 显然,只有admin才能新建Episode 我们来实现admin?方法 adm ...
hideto 评论 (0) 有 988 人浏览 2011-05-26

知识库信息

最新评论

不能适应超过三层的的override,比如我有A,B,C三个模板,B在A的基础上添加自己的东西,C在B ...
mingliangfeng 评论了 Rails宝典之第八式: layout与content_for
讲的很清楚,赞
lixinso 评论了 ActionController::Resources + ActiveReso ...
这个插件的下载地址:https://github.com/rails/ssl_requirement
kaogua 评论了 每天一剂Rails良药之ssl_requirement
能评论吗???
refar 评论了 Rails宝典之第五十一式: will_paginate
<%= error_message_on "post", "ti ...
fcp6316 评论了 Rails宝典之第六十五式: Stopping spam
rake db:fixtures:load # Load fixtures into the cur ...
xu_ch 评论了 Rails宝典八十一式:Rails2.0之Fixtures尝 ...
[/b][i][/i][u][/u]引用[color=red][/color][size=medium ...
linjie_830914 评论了 Rails源码研究之ActionController:二,ro ...
并行工程环境的面向成本设计
libiun 评论了 Rails宝典八十五式:YAML配置文件
...
xu_ch 评论了 Rails宝典之第五十七式: Select or Create
你老好了,找的就是他了
xu_ch 评论了 Rails宝典之第七式: layout详解
Global site tag (gtag.js) - Google Analytics