recording 是一个高级功能,对于我来说。所以我一直没有学习哈哈。前天又做了一件人肉替换字符串的事儿,我觉得实在不能再忍了,于是今天早上使用了一下,感觉良好。 (Recording is an advanced feature in VIM and I am too busy these days, so I haven't paid any time on it. However t...
使用request Log Analyzer分析rails日志(usingrequest Log Analyzertoanalyzeyourrailslog)
这个东东非常强大,可以分析Rails, Merb, Nginx, Apache, MySQL, postgres, 等各种日志。  ( it supports many formats of logs , including: mysql, postgres, apache .nginx ... ) $ gem install request-log-analyzer ...
Asset_path在rspec中的使用(useasset_pathinrspec)
今天很奇怪,我在测试 helper 时,居然遇到了 这个问题: ( today I met a strange problem when testing a Rails helper which called asset_path ) undefined method `asset_path' for #<rspec::core::examplegroup::nested_2:0x8...
Rspec中模拟cas登录(mockloginforcas)
非常简单,用这个:  ( 1 line of code: )  CASClient::Frameworks::Rails::Filter.fake("some_user") 例如:  (e.g. )  # spec_helper.rb  : define a method called 'login') def login CASCl...
Rubymetaprogrammingspell:alias_method_chain
了解这个spell的基础是,你要知道 alias_method :的用法: alias_method :new_name, :old_name 这个东东非常常见,遍及RAILS代码的每个角落。起源是: 1. 假设我们希望为某个方法加上新功能:  可以用 alias_method. ActionController::TestCase.class_eval do # sa...
关于rubycasclient和singlesignout(aboutruby Cas Clientandsinglesignout)
昨天搭建了ruby cas server, 今天使用了一下,效果良好。   ( I setup my CAS server yesterday, and it's running well)  下面是使用ruby CAS CLIENT的步骤:  (参考:http://sg552.iteye.com/blog/1297538 )  ( below is ...
Rails的精髓之:activesupport(studyingacitve Support)
用了Rails 4年多了。不过还没认真看过ActiveSupport. 只是发现很多优雅的方法都是出自于其中: blank?  in? revert_merge try 所以,今天看了一下。发现最重要的一点是:如何引用 ActiveSupport: require 'active_support'  # doesn't work require 'active_sup...
最全的rubyrails保留字(rubyrailsreservedwordscomplete)
原文见: http://latheesh.com/2010/02/02/rails-reserved-words/ Rails doesn’t like it if you name your models and columns some of the words that it uses in the framework. This is a ...
一个视图层的gem:apotomo(rubygemapotomoforrails.)
好吧,我失败了。。。 没有成功的跑起来,虽然经过查看源代码等等修改,也还是一直有失败消息。我怀疑这个GEM 不兼容 3.2.11 ,或者作者已经停止维护了(上一次提交代码是2个月前,再一次是8个月前,还有20+ issue没有 解决, 好多pull request 没有处理) (OK, I admit that I failed to manage this to work. I d...
Rbenv的基本用法(basicusageaboutrbenv)
111跟RVM类似,RBENV提供了轻量级的RUBY切换方法。我们看一下: 1. 安装RUBY: RVM自动帮你安装, RBENV需要你手动安装RVM:  $ rvm install 1.9.3  RBENV:    ( or use rbenv install ) $ ./configure --prefix=/opt/.rbenv/ver...
Rvm与rbenv(rvmandrbenv)
参考(refert to ):  http://jonathan-jackson.net/rvm-and-rbenv 今天早上发现公司服务器上装的是RBENV,跟 RVM是一个类型的工具,切换不同版本的RUBY。所以搜索比较了一下两者的用法和优劣。
Rails中的rubygem:cells(cellsrubygem)
这几天在弄Rails engine gem, 然后从 regular rubygem -> enginex -> rails plugin ->  Apotomo  -> 'cells'.    ( these days I am dealing with how to setup 'rails engine gem', the...
Ssh相关(端口号,密码等等)(sshrelatedparameters)
公司使用了特殊的SSH 端口号,我总容易弄错,所以把相关的信息贴在这里: ( our server in company uses a special port rather than usual 22 which always making me confused.  so I have to post related tips here )  1. scp 例子: &...
建立railsenginegem(howtowritearailsenginegem)
注意:这个文章只针对Rails3.0.x 对于 后面的版本  , 请看 $ rails plugin new (Enginex is only available for Rails 3.0. *For Rails 3.1 onwards, Enginex was ported to Rails as `rails plugin new` by Piotr Sarnacki.* ...
Bundle遇到问题的终极解决办法(howtosolvestrangebundleproblems)
今天遇到一个很奇怪的bundler 问题,某个 gem安装明明是正确的,就是运行起来提示说找不到gem .   ( today I met a very strange problem about bundle that it complains no corresponding gem found while actually all the gems are installed...
对ruby几个版本的测试(performancetestforseverialrubys)
前几天看到这个文章: http://inosin.iteye.com/blog/1740633 以及robbin的微博,说道更换RUBY PATCH 之后带来的性能100%提升,我打算在自己的项目中实际测试一下。   不仅仅是跑 $rake routes, 我要跑遍所有的 test case, 这样更有代表性。  ( several days ago ...
如何查看某个action的restful类型?(howtodeterminetherestfultypeofanactioninrails?)
今天为了这个问题想了半小时。呃。。。又是看RAILS源代码又是查文档啥的。 后来才发现,有个灰常简单的方法:  ( today I spent half an hour on this question, checking both the source code  and the documentation.  at last, I found this ve...
从ruby1.8转移到1.9之后的rspec用法变化(rspecusagechangesfromruby1.8toruby1.9)
in ruby 1.8, we use: $ rspec spec however, in 1.9 , we have to specify the current path, e.g. $ rspec spec -I .     more refer to :  http://stackoverflow.com/questions/11376718/requi...
在rails中,删除某个hash中的多个key(deletemultiplekeysfromahashinrails)
参考: http://stackoverflow.com/questions/1560572/ruby-delete-multiple-hash-keys sg552@youku:/sg552/workspace/postman$ bundle exec rails c Loading development environment (Rails 3.2.9) >> ap...
三种ruby论坛的比较(comparasionfor3rubyforums)
最近在考虑是不是要做个论坛,因为有好几个项目需要。但是动手之前,还是先看看有没有现成的轮子。 论坛按理说应该是最常见的应用。比如大名鼎鼎的 JIVE (JAVA 论坛),那性能叫一个惊人(使用了各种cache 等优化) 。( I need a forum application for my projects, but before writing my own, I plan to see...