ruby on rails
iteye_3141
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
rails find 面向SQL的参数
find(:all),find(:id),find(:first):conditions 指示条件或要匹配的条件:group 指定结果按某一属性分组,使用了SQL的group by:include 使用sql的left outer join指定应包括的关联:joins 指定其他的sql连接:limit 指定一个整数,设置返回行数的上限...2008-12-18 11:18:33 · 148 阅读 · 0 评论 -
rails 字符串
字符串的内嵌形式;1."show" %>2.def hello(name) " Welcome, #{name} !"end3.Post.find(:all,:conditions=>'id= #{params[:id]}')2008-12-18 15:01:27 · 170 阅读 · 0 评论 -
rails mod_rails的使用
使用mod_rails搭建基于apache的rails运行环境Passenger(mod_rails)是一个基于apache的rails应用部署方案,目前支持Linux,BSD,OS X平台,暂不支持windows,安装和部署rails应用非常简单,执行效率也非常高,适合于生产环境rails应用的部署。安装方法:sudo gem install passengersudo pa...原创 2009-01-09 11:46:56 · 222 阅读 · 0 评论 -
rails checkbox
通过获取的id值来设定相应的标志位为1,或者为0view: "approve",:method=> "post" do %> controller: def approve Student.update_all(["status=?", 1], :id => params[:students]) end...2008-11-21 15:45:24 · 276 阅读 · 0 评论 -
rails 日期(date_select)
日期选择框:实例:date_select "post", "attribute"date_select "user", "birthday", :start_year => 1910date_select "user", "cc_date", :start_year => 2005, :us原创 2008-11-26 15:09:23 · 502 阅读 · 0 评论 -
ruby calendar
def month_day(month, year=Date.today.year) mdays = [nil, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] mdays[2] = 29 if Date.leap?(year) mdays[month] end def calendar(month,...原创 2008-11-26 16:39:38 · 189 阅读 · 0 评论 -
rails select
1.2."-----"}}) -%>3.4."-----"}}) -%>2008-11-27 13:58:55 · 155 阅读 · 0 评论 -
rails tag中的name加入参数
两种不同的效果,之相差在""和''for day in @days1.产生的html:......2.产生的html:......2008-12-02 14:04:26 · 173 阅读 · 0 评论 -
rails select 二级联动
Ruby on Rails 编程之select二级联动简例功能:点击select下拉菜单,选中某一option, 页面中的text随着更新要点: 1. select的简例 2. 如何控制selected 即按条件显示指定的option 3. 如何根据select结果刷新页面 1 select 的语法: 如何控制selected 即按条...原创 2008-12-03 16:02:38 · 349 阅读 · 0 评论 -
rails截取字符串,点击more的时候显示
页面中的description比较长, 想截取一部分,后面的用more代替,点击more的时候显示全部。这种情况比较长见。代码如下:在application.helper中写个方法: def truncate_with_more (text, cutoff, id) if text.length > cutoff result = text...原创 2008-12-04 15:05:21 · 163 阅读 · 0 评论
分享