Archive for January, 2011
Ruby on Rails 3 RESTful and default routes
You have probably created some action in your controller class and can’t access it right? Well you need to have some default routing rules set up in order for rails to understand the url and route it to the appropriate action and controller. This will happen alot with AJAX calls where you simply want to [...]
Example using ruby blocks, lambda and Proc
What really distinguishes ruby from other languages is the syntatic sugar of blocks. For example, blocks really come in handy when iterating thru a collection. The example: (1..10).collect{|i| i*i} => [1, 4, 9, 16, 25, 36, 49, 64, 81, 100] But how does the collect method work? Let’s define an array containing all the prime [...]