每天一剂Rails良药系列,是《Rails Recipes》这本书的读书笔记。希望对您有所收获。
讨论
话题 作者 回复/点击 最后回复
> 更多讨论
群组知识库

Rails宝典之第十九式: admin在哪里

我们通常对admin页面的做法是运行: ruby script/generate scaffold xxx 'admin/yyy' 其中xxx为我们的singular的Model名,而yyy为我们的plural的Model名 这样就相当于做了一套cms,后台页面和前台页面是两套东西 其实我们还有一种简单的admin方式,就是在前台页面直接加上管理的链接: <div id="e ...
hideto 评论 (0) 有 1467 人浏览 2011-05-26

Rails宝典之第十八式: 循环flash

我们在application.rhtml(global layout)里经常需要写各种flash的显示: <% unless flash[:notice].nil? %> <div id="notice"><%= flash[:notice] %></div> <% end %> <% unless flash[ ...
hideto 评论 (0) 有 1348 人浏览 2011-05-26

Rails宝典之第十七式: 多对多Checkbox编辑

这次是讲多对多情况下的编辑,我们使用Checkbox来完成该工作: class Category < ActiveRecord::Base has_and_belongs_to_many :products end class Product < ActiveRecord::Base has_and_belongs_to_many :categories end 上面Category ...
hideto 评论 (0) 有 2448 人浏览 2011-05-26

Rails宝典之第十六式: 虚拟属性

看一个场景,用户注册时需要填写First Name,Last Name,Password: <h1>Register</h1> <% form_for :user, :url => users_path do |f| %> <p> First Name<br/> <%= f.text_field :first_name %&g ...
hideto 评论 (0) 有 1308 人浏览 2011-05-26

Rails宝典之第十五式: find条件

数据库查询的conditions除了简单的字符串,还可以用数组,range,nil等等,看看代码: Task.find(:all, :conditions => ["complete=? and priority=?", false, 3]) Task.find(:all, :conditions => ["complete=? and priority ...
hideto 评论 (0) 有 1758 人浏览 2011-05-26

小组成员32人 浏览198409次 成员列表

发起人: hideto
管理员: hideto

新加入成员

群组活动表
2024-05
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    

群组信息

Global site tag (gtag.js) - Google Analytics