RSS and Atom RXML templates for Rails





The great guys over at New Bamboo (a British Ruby on Rails development team) have launched a new blog and their first post is a tour through the testing methods available in Rails. It's ideal for those who've fallen behind with their Rails testing knowledge or those who want to get up to speed quickly.
Lucas Carlson comes up with a cute trick to make Ruby feel a little more like a prototyped language by allowing you to define methods on a class in real-time through child objects, like so:
Simple "Send Email from Ruby" method - Using Net::SMTP to talk to the local SMTP daemon directly to send mail. Not elegant, but a useful quick hack.
HTTP Request => Rails 'params' GET: /users => [:action => 'index'] GET: /users.xml => [:action => 'index', :format => 'xml'] GET: /users/1 => [:action => 'show', :id => 1] GET: /users/1;edit => [:action => 'edit', :id => 1] GET: /users/1.xml => [:action => 'show', :id => 1, :format => 'xml'] POST: /users => [:action => 'create'] PUT: /users/1 => [:action => 'update', :id => 1] DELETE: /users/1 => [:action => 'destroy', :id => 1]
Prolific 'Edge Rails' blogger Ryan Daigle has written "Simply RESTful Support - And How to Use It", a great walkthrough of the features offered by the simply_restful plugin that's now a core part of Edge Rails and which will provide a lot of the new functionality to be seen in Rails 1.2.
Expat is the recognized big daddy of XML parsing. It's a stream-based XML parser written in C and, as a library, is used for XML parsing functions by many languages. Rubyists have tended towards REXML, however, a more flexible (though infinitely slower) parser. Sam Ruby, however, has come up with some techniques to get Ruby's REXML working with Expat.

![]()
I've joined forces with Obie Fernandez on the Ruby section at InfoQ, a prime news site for the enterprise software development community. The Ruby news at InfoQ has more of an enterprise feel to it than that here at RubyInside and is focused at team leaders, development managers, enterprise developers, etc, so there's less hacking, but more high-level Ruby stuff.

After writing a basic routine to print all prime numbers between 1 and 10,000 in Ruby, Pat Eyler found it took almost 3 seconds to complete, and seeked out a way to make it faster. Enter RubyInline (covered previous at RubyInside).. With RubyInline he added a basic C function into the Ruby mix and knocked down the time required to 0.3 seconds.