Thursday, March 26, 2009

Rails on Git

Git is one of the extreme repository storage media. Its similar kind of Subversion(SVN), CVS, Mercurial, etc revisioning system. Its pretty much useful for rails kind of frameworks. Even our Rails gem also switched to Git repository from SVN.

I feel more happy to work with it. Its fast and furious. i'll suggest you to adopt into this technology.

Today i have found one superb tool to find the difference and merging the conflicted file by comparing between the local and remote files with Good GUI.

man page for git mergetool

meld is one of the tool to find the difference between multiple files. Use the below command to run the tool.

git mergetool -tool=meld


Sample Dispaly for this tool:



I will update about GIT regularly on either gokulamurthy.blogspot.com or on this.
Keep Updating your knowledge.

Friday, March 20, 2009

map method is one of the best methods in rails

This methods will turns the symbol to proc.

Here is an example:

>> tcs = TemplateCompatibility.find :all, :select => "DISTINCT id, template_id"
=> [#"1", "id"=>"1"}>, #"2", "id"=>"2"}>, #"3", "id"=>"3"}>, #"4", "id"=>"4"}>, #"5", "id"=>"5"}>, #"6", "id"=>"6"}>, #"7", "id"=>"7"}>, #"4", "id"=>"8"}>]

If you want to extract a specific field from the above result set or an array, here in the above example i want to extract specifically template_id values, then we can use "map" method to get the values in a new array. Here is the syntax to use it with this example.

>> tcs.map(&:template_id)
=> [1, 2, 3, 4, 5, 6, 7, 4]

Enjoy Coding & hacking too!

Thursday, March 19, 2009

Difference Between rspec and rspec-rails gems/plugins

rspec gem or plugin => basic rspec without rails support (runner, rake
task, api for describe/it, should etc)

rspec-rails gem or plugin => extra support for rails model view and
controller, database integration, code generation (script/generate)

It doesn't matter whether you use the gem or the plugin. Just pick one
that suits your project.

Tuesday, March 17, 2009

Free E-Magzines for Rails

"The Rubyist" and "Rails Magazine" are the magazines has announced to download their issues as E-book/E-Magazine per month. You can download their issues from their official websites itself. That is,

http://therubyist.com/

http://railsmagazine.com/


Download and Enjoy :)

Keep on improve your skills and knowledge in Ruby On Rails.