Pratik lately is doing a great work refactoring ActiveRecord to make a full use of relations. Speaking in code language, this means that in Rails 3 you will be able to do:

User.where(:name => "Jose").order("birthday")

And it will return a relation. The relation can be further manipulated and the query is only triggered when you call all, first, to_a or some Enumerator method.

Besides that, he’s also doing some crazy experiments, which will probably become a plugin later. While discussing with Pratik some ways to implement equality and inequality, I discovered a neat ruby trick. Open up an irb session and do:

I’m writing a parser with Treetop and used this feature to simplify the usage in irb. When I write -“sample” my lib load a file called “sample” in the current directory, execute the parser on its content and return the generated tree.
It’s a cool feature 😉

Samuel Flores

I’m writing a parser with Treetop and used this feature to simplify the usage in irb. When I write -“sample” my lib load a file called “sample” in the current directory, execute the parser on its content and return the generated tree.
It’s a cool feature 😉

Things go even more funny with the Ruby 1.9 file encoding support and “crazy methods”! For example, a not so nice to type method like ∑ could be used like User.∑, returning the users count or User.∑(:credits) returning the sum of the users credits on the system or something like that. Ok, ∑ is not really a cool example, but … 😉
More about it here http://tinyurl.com/5j8ofe and http://tinyurl.com/5l9xgd

Things go even more funny with the Ruby 1.9 file encoding support and “crazy methods”! For example, a not so nice to type method like ∑ could be used like User.∑, returning the users count or User.∑(:credits) returning the sum of the users credits on the system or something like that. Ok, ∑ is not really a cool example, but … 😉
More about it here http://tinyurl.com/5j8ofe and http://tinyurl.com/5l9xgd