
Ruby 技术
tumayun
这个作者很懒,什么都没留下…
展开
-
ruby Array等对象深拷贝
浅拷贝:a = [1, 2, 3, 4]b = aa << 5pp a, b#=> [1, 2, 3, 4, 5]#=> [1, 2, 3, 4, 5] 深拷贝: a = [1, 2, 3, 4]b = a.dupa << 5pp a, b#=> [1, 2, 3, 4, 5]...原创 2011-10-26 11:40:11 · 596 阅读 · 0 评论 -
rails 中 利用方法名达到传递参数的效果
如果你需要写很多batch方法,但是操作都是一样的,只是参数不一样而已,而你又不想传参数,就可以使用method_missing方法,rails中的find_by_方法就是利用这个来实现的。def method_missing(sym, *args, &block) if sym == :add_datas_to_user add_datas('user') ...原创 2011-11-17 11:07:43 · 336 阅读 · 0 评论 -
rails3 使用 bootstrap
在你的rails3项目里面使用twitter's bootstrap只需要安装一个gem包就ok了快来试试吧! gem 'less-rails-bootstrap'相当简单,下载bootstrap可以到http://twitter.github.com/bootstrap/去下载 更多关于less-rails-bootstrap的资料可以看http://opin...原创 2012-02-09 23:22:11 · 134 阅读 · 0 评论 -
rails2.3.2 ExceptionNotifier 配置
必须先在项目中要加入plugin exception_notifier(附件就是) 然后首先在development.rb文件中加入ActionMailer::Base.delivery_method = :smtpActionMailer::Base.smtp_settings = { :address => "smtp.a-it.jp", ...2012-02-10 11:52:33 · 123 阅读 · 0 评论 -
Rails Caching Stores
粘贴至Rails APICaching storesAll the caching stores from ActiveSupport::Cache are available to be used as backends for Action Controller caching. This setting only affects action and fragment cachi...2012-06-28 23:54:34 · 113 阅读 · 0 评论