Ruby researches
August 28th, 2008 by prozzJuggernaut - interesting stuff, needs evaluation.
Juggernaut - interesting stuff, needs evaluation.
I’m proud to announce, that baduk.pl portal I was working on recently is in beta stage. It’s an archive for baduk game records (in polish for now). Many various people helped me with this project and I want to say thanks to them here. Especially to Greg, who helped me a lot with CSS stuff. Hopefully there are not too many bugs, so I could focus on new features now. Cheers!
I got some free time lately, so I sat down trying to figure out how to make pagination of tagged entities. I’m using acts_as_taggable_on_steroids plugin for tagging and will_paginate for pagination of some standard queries.
Pagination plugin allows you to replace ‘find’ method with ‘paginate’ one:
Game.find(:all)
Game.paginate(:all, :page => 1)
Tagging plugin allows ‘tagged_with’ suffix to any ‘find’ method call:
Game.find_tagged_with('tsumego')
It’s easy to find out, that all I needed was:
Game.paginate_tagged_with('tsumego', :page => 1)
This is the power of dynamic languages. Pretty simple and really useful. All those small magic tricks makes writing software in RoR really exiting!
Todays winner is: gemsonrails.
RoR of course, here it is: has_finder.
In case you know some answers, please make my life easier and send me an email. Cheers
Here you can find great article about Vim editing in practice. Recommended for nonbelievers.
Today is the happy day
After short break (two months), I’ve reached 9k on KGS recently by beating 7k, 8k and 4k in handicap games and started to play regulary. At least one game a day fully focused. Then study ‘Tesuji’, ‘Opening Theory Made Easy’ or ‘Lessons in the Fundamentals of Go’. Shodan challenge has been started - I can do this ![]()
Well, I have to be honest - I’m not the emacs guy and after a few tries of the editor I abandon the idea for emacs to become my Rails/Ruby IDE. The features looked yummy on the screenshots, but practicing Vim Zen is better
After being defeated by emacs, I focused on finding the best solution for old, good Vim. Here is what I found usable for RoR developer:
Just paste each script name presented above here to find newest versions of them.
My additional snippets I found usable are:
exec "Snippet vn validates_numericality_of :".st."field".et.st.et
exec "Snippet vl validates_length_of :".st."field".et.", :maximum => ".st."max".et.st.et
exec "Snippet vc validates_confirmation_of :".st."field".et.st.et
exec "Snippet vp validates_presence_of :".st."field".et.st.et
exec "Snippet vu validates_uniqueness_of :".st."field".et.st.et
PS. I’m 10 kyu now and won today with 9 kyu with 25 points! I can do it! I will do it! ![]()
PS 2. supertab.vim is cool too ![]()
PS 3. I’ve got here vim-ruby of course too…