
ruby&ror
文章平均质量分 64
iteye_15860
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
ROR网站
# gemshttp://rubygems.org/ # ruby forumhttp://www.ruby-forum.com/ # rorhttp://rubyonrails.org/ # ror guidehttp://guides.rubyonrails.org/ # ror apihttp://api.rubyonrails.org/...原创 2011-07-07 10:56:12 · 294 阅读 · 0 评论 -
rails3 更新时间问题
rails3 更新时间问题(updated_at)(未完) ruby:1.9.2rails:3.0.3 一般来说,对表进行设计时候,如果不做对创建时间与更新时间做任何处理的话,rails则会默认给你加上。用来监控表中的记录 创建记录rails会把现当前的时间作为值,同时设置给created_at与updated_at 更新记录如果表中的记录发生变更的...原创 2010-12-18 21:52:54 · 158 阅读 · 0 评论 -
rails3 flash 清除问题
rails3请求之后,flash内容没有被清除? flash经常用在controller, 与view中,用来传递与表示信息,通常有修改记录成功,表示一些错误提示内容等。 flash在两个action中传递临时对象,之后,再被清除理论上是这样的吧,事实上有时你会发现flash内容没有被清除,而且还会在不只一次次的请求中表现出来,现在这样的情况的原因,很简单就是flash的内容没...原创 2011-01-05 21:35:11 · 144 阅读 · 0 评论 -
关于restful_authentication密码更新问题
使用restful_authentication插件时,进行更新密码操作时,如果传来密码为空时,会发现有关密码验证空值验证会失效 这是因为在by_password.rb文件中,是这样记录的 # Stuff directives into including module def self.included(recipient) recipi...原创 2011-01-05 22:28:49 · 297 阅读 · 0 评论 -
插件扩展
在ruby on rails3 的guides,插件扩展中有这样一段代码http://guides.rubyonrails.org/plugins.html#add-an-instance-method module Yaffle def self.included(base) base.send :extend, ClassMethods end m...原创 2011-01-28 11:24:59 · 203 阅读 · 0 评论 -
插件扩展(2)
ruby:1.9.2rails3.0.3 学习编写插件的这个过程中,自动引入plugin中的models, controllers等组件的过程中,加入以下代码出现这样的问题http://guides.rubyonrails.org/plugins.html#models 加入代码:%w{ models }.each do |dir| path = File.joi...原创 2011-01-28 16:41:13 · 205 阅读 · 0 评论 -
rails3 jquery ajax
rails3中使用非form提交的ajax操作,这里使用的js框架为jquery html(views/users/index.html.erb):<%= link_to "ajax_update", ajax_update_user_path(user), :id => "ajax_update_" + user.id.to_s %>这里没有使用rails....原创 2011-01-30 14:56:02 · 121 阅读 · 0 评论 -
Notifications in Rails 3
249: Notifications in Rails 3 rails3的通知/报告等一系列的处理体系, asciicasts介绍两种用途(1) 记录每个次请求的响应时间,以了解系统的性能如何(2) 通过自定义的instrument来记录检索的关键字 发布/订阅之间的关系,把与主逻辑不相关的处理进行分离,在其它的地方进行处理。同时,其中文中也说到了,这样也带来了一些风险,如代码...原创 2011-02-11 10:34:54 · 172 阅读 · 0 评论 -
rails3 update_all 使用:order, :limit条件时,忽略条件问题
这个bug是在使用delay_job(2.1.2)查出来的,后来google了一下,发现已经有人提交了这个问题 delay_job中如果有失败任务的话,后台会一直不停的运行失败任务源代码修改,加注释的为原来的代码,注释后的为自己添加的修改代码 # Reserve a single job in a single update query. This causes w...原创 2011-02-11 11:08:29 · 207 阅读 · 0 评论 -
rails 开源blog typo
rails open source blog:http://fdv.github.com/typo/原创 2011-12-26 16:23:40 · 125 阅读 · 0 评论 -
Ruby基本数据类型
d(转)http://blog.youkuaiyun.com/foreverphoenix/archive/2009/05/06/4155385.aspx 数字1、Ruby支持整数和浮点数。整数可以使任何长度。一定范围内的整数是Fixnum类的对象。范围之外的整数存储在Bignum类的对象中。这种处理是透明的。 2、...原创 2010-12-09 08:55:23 · 109 阅读 · 0 评论 -
ruby 1,9 多字节字符
ruby 1.9 String类 length 与 size 方法返回字符数bytesize 方法返回字节数 encoding方法返回字符串的编码方式 force_encoding方法显示地设置一个字符串的编码方式,注:它不改变底层的字节 text = stram.readline.force_encoding("utf-8)bytes = text...原创 2010-12-08 08:53:50 · 203 阅读 · 0 评论 -
Validation Helpers(数据验证)
validates_acceptance_of# checkbox 提交后的设置的默认值 class Person < ActiveRecord::Base validates_acceptance_of :terms_of_service, :accept => 'yes'end validates_associated# 关联验证# 验...原创 2010-11-22 08:33:11 · 270 阅读 · 0 评论 -
使用cookie的session
使用cookie 的session 修改/depot/config/environment.rb 添加或激活这段代码 config.action_controller.session_store = :active_record_store原创 2010-11-22 08:36:26 · 80 阅读 · 0 评论 -
each, map, collect
each, map, collect arr = [1,2,3] 1) arr2 = arr.each{|element| element = element * 2} #arr与arr2仍然都等于[1,2,3]?? each返回原数组 遍历内对元素的更改不会保存 2) arr2 = arr.map{|element| element = element...原创 2010-11-22 08:38:41 · 122 阅读 · 0 评论 -
Ruby Blocks
Ruby Blocks Block构成 A block consists of chunks of code. You assign a name to a block. The code in the block is always enclosed within braces ({}). A block is always invoke...原创 2010-11-22 08:41:51 · 111 阅读 · 0 评论 -
rails3 scope dead???
看到一篇关于rails中是否还继续推荐使用scope的文章 Named Scopes Are Deadhttp://www.railway.at/2010/03/09/named-scopes-are-dead/ 另一个讨论Named Scopes Are Deadhttp://www.rubyflow.com/items/3566 其中在arel上有一个b...原创 2010-11-29 18:37:07 · 98 阅读 · 0 评论 -
Migration and Database Column Types
rails下迁移类与数据库类型对照表: Migration and Database Column Types db2mysqlopenbaseoracle:binaryblob(32768)blobobjectblob:booleandecimal(1)tinyint(1)boolea...原创 2010-11-30 23:09:29 · 108 阅读 · 0 评论 -
About Resouce
关于RESTful风格的URL设计 Singular(单数) resourceful route: resource :geocoder creates six different routes in your application, all mapping to the Geocoders controller:VerbPa...原创 2010-12-02 21:40:02 · 100 阅读 · 0 评论 -
Here document
Here document 用于引入一段较复杂的内容,其中包括了可能出现的各种字符 语法以<<或<<-开头,后面紧跟一个标识其结尾的字符或字符串。下一行开始表示引入的字符内容,遇到结束符时表示,引入的内容结束 简单的:document = <<HEREThis is a string literal.It ha...原创 2010-12-07 08:55:08 · 117 阅读 · 0 评论 -
Rail3 Plugs
Rails3 PlugsGemfile [1] test-unit/单元测试gem 'test-unit', '2.1.2' [2] sunsnop/检索gem 'sunspot_rails' [3] ruby excel 插件 gem install spreadsheetguide:http://spreadsheet.rubyforge.org...原创 2011-02-11 11:24:08 · 113 阅读 · 0 评论