`
ywencn
  • 浏览: 85089 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论
文章列表
转载自:http://blog.csdn.net/xieqibao/archive/2007/11/02/1862796.aspx   页面中的description比较长, 想截取一部分,后面的用more代替,点击more的时候显示全部。这种情况比较长见。代码如下:在application.helper中写个方法:  def truncate_with_more (text, cutoff, id)        if text.length > cutoff          result = text[0, cutoff]          result += "< ...
rails在model层进行验证,在页面直接调用   <%= error_messages_for 'model名' %>   可这样页面出来的错误信息全部是英文的,而且rails是直接取数据库的字段名来显示错误信息,这样肯定是不合理的.我们通过自定义一个 error_messages_for 方法作为helper,显示在model验证时自定义的:message   module ApplicationHelper def error_messages_for(object_name, options = {}) options = options ...
将GoogleMap轻松应用到Rails中 2009-01-08 14:23   首先描述一下示例的开发环境: Ruby on Rails:2.0.2 Ruby:1.8.6 数据库:MySQL Ruby IDE:NetBeans Ruby IDE 6.1 Rails 插件:GeoKit、Cartographer 创建Rails 工程gmaps,并指定其数据库为MySQL
-- mysqlmysql> create table tb(id int,data varchar(20),            chs_data varchar(50) character set 'gbk') character set 'latin1';Query OK, 0 rows affected (0.09 sec)mysql> insert into tb values(1,'mysql','小梁爱兰儿');Query OK, 1 row affected (0.05 sec)mysql> insert into t ...
 原文:http://www.mattephraim.com/blog/2008/12/31/a-quick-little-extension-to-the-spreadsheet-gem/   由于公司业务需要上传大量EXCEL数据,以前使用ASP上传,控件会把EXCEL当做数据集来进行处理,现在换SPREADSHEET,只能当做数组,非常不方便,希望 ...
Global site tag (gtag.js) - Google Analytics