from ruby facets: class Hash def update_keys #:yield: if block_given? each{ |k,v| delete(k) ; store(yield(k), v) } else to_enum(:update_keys) end end def key_downcase! self.update_keys{|k| k.to_s.downcase} end end
Category Archives: ruby and rails
Rake db:migrate to previous version
Migrate to previous version: rake db:migrate VERSION=xx Tags: rails
Posted in ruby and rails Leave a comment
Correct usage for with_scope
see this link for the correct usage for with_scope I’m still looking for a way to do a more complex query with scope. For example what if I want to find all data that is public, or private but belongs to me. Maybe with_scope is the right tools, maybe not. I have to find out [...]
Posted in ruby and rails Leave a comment
Unit Testing Framework; Separating Code and Testing Data
If you ever read my background, you’ll know that I’m currently working on developing web browser for mobile phone in my company. Well, developing Web Browser is not an easy task; A regular web browser can easily have thousands of requirements. Making sure that whenever we implement something, it doesn’t break other part is becoming [...]
Also posted in idea / rant, Uncategorized Leave a comment