Josh Peek officially joins the Rails core

Josh Peek has been a defacto Rails core committer for a while, but for some reason we’ve never actually made the appointment official. So here it goes: Josh Peek is the latest Rails core team member. Three cheers hurray!

Josh has been working on a Google Summer of Code project to bring thread safety to Rails and is just about ready to wrap it up. Rails 2.2 will be thread safe thanks to the work that Josh has put into it.

Of more importance, though, is the significant effort put into making things faster and cleaner as part of that push. The actual thread safety won’t really matter much to most people, but it’ll surely look nice on your enterprisey check list of Features Your Framework Must Have To Get Play Around Here.

In any case, please welcome Josh!

Hackfest

And once again, hackfest is back. Only this time, it’s better than ever, thanks to Git

The idea is quite simple. You get 5000 points for each of your patches that get merged to the core. The person with the highest points at the end of the month wins.

August hackfest is already on and almost 3 more weeks to go, so hack on for the first prize – a free pass to RailsConf Europe ( special thanks goes to O’Reilly for the prize )

If you’ve never contributed to Rails before, now is a good time. This railscast is a nice head start.

Thanks to all those who have contributed to Rails, making it better and better.

Bratwurst on Rails at RailsConf Europe

From the Bratwurst on Rails team:

Fellow Rubyists from Berlin cordially invite all participants of RailsConf Europe to a barbecue in good old German tradition. The event is an opportunity to socialize and meet the conference participants in a relaxed atmosphere, and to make your name or brand known amongst them. Members of the Berlin Ruby Usergroup will take care of your stomach, and drinks will be available at fair prices.

The venue will be in the heart of Berlin, close to the conference venue. Entry will be free, as will the food. (If you’re interested in sponsoring, have a look at our sponsoring packages and feel free to contact the organisation board via sponsoring@bratwurst-on-rails.com). Your bratwurst awaits you!

It’s happening September 1st.

This Week in Rails (July 26, 2008)

Welcome to the fourth edition of This Week in Rails, a weekly (and occasionally fortnightly) report with highlights from the Rails community.

David broke the news of the availability of confirmed and scheduled talks at RailsConf Europe which will be taking place this coming September. As you can see there will be a lot of exciting material this year, too.

The e-book Ruby on Rails 2.1 – What’s New is now available in 7 languages: English, Portuguese, Japanese, Simplified and Traditional Chinese, Italian and Korean. A Spanish version is coming as well. Olé!

A couple of weeks ago I took a close look at three Rails 2.1 database related bugs. On the same day, Phusion Passenger 2.0.2 was released. This edition backports a few bug fixes, including one for a small memory leak, and as such it’s highly recommended for anyone using Passenger 2 (aka mod_rails).

Kawaii is a web-based utility like script/console. The output of the inserted expression is visually appealing when compared to the one we’re used to in the shell. Speaking of shiny things, version 2 of the Open Flash Chart plugin was released. This page shows a few wicked cool, professional looking charts (and their code) that can be generated with it.

The article Mulling Over Our Ruby On Rails Full Text Search Options discusses a few possible options for performing full text searches in Rails applications. When it comes to Sphinx, there are then two prominent plugins: UltraSphinx and ThinkingSphinx. Rein Henrichs from Hashrocket, compares the two approaches in his post titled A Thinking Man’s Sphinx.

The team behind Rails-Doc.org added a few more functionalities, including the ability to document the API for multiple versions of Rails.

Other noteworthy articles were the following:

Ryan Bates was interviewed by FiveRuns and his insightful answers are reported in Rails TakeFive: Five Questions with Ryan Bates. He also published a couple of new railscasts on Liquid safe templates and on Session Based Models.

Rails Envy podcast number 39 was published this week. Check out also their hilarious video about Outdated HTML. And if you haven’t done so already, don’t miss the funniest voicemail and remix the Rails community has heard to date: We ain’t got no RSpec.

If you’d like to read more updates from the Ruby side of things, please head over to This Week in Ruby.

Internationalization in edge Rails and more

There won’t be a Living on the Edge this week, but you won’t be starved for info because the Rails community is keeping up.

Ryan Daigle has been keeping up with some of the changes on edge Rails and has done a few awesome explanatory posts on them:

Perhaps even more noteworthy is the introduction of I18n (internationalization) support to Rails core. Sven Fuchs explains the technical details and API as well as the history of Rails and I18n. I18n support is scheduled to be fully stable in the Rails 2.2 release. Have an interest in internationalization in Rails? Lend a hand with your ideas, feedback, and patches at the Google Group.

This Week in Rails (July 11, 2008)

Welcome to the third edition of This Week in Rails, a weekly report with highlights from the Rails community. My apologies for the delay of this post, the past two weeks have been pretty crazy, so this edition covers the most interesting articles and news from the past two weeks.

Let’s kick off this report with a couple of maintenance releases by Jamis Buck. Both Capistrano 2.4.3 and Net::SSH 2.0.3 were published two weeks ago. If you use them, consider upgrading.

Rails 2.1 has been out for a while now, but in case you didn’t have a chance to catch up yet, this post collects several links to useful resources which will help bring you up-to-date.

The Pathfinder Development’s blog put out three highly interesting posts. The first is More Named Scope Awesomeness by Noel Rappin, while the second and third ones are Pretty blocks in Rails views and DRYing up Rails Controllers: Polymorphic and Super Controllers, both by Josh Symonds. Another good (and quick) recent read about controllers, was "MVC: How to write controllers ":http://andrzejonsoftware.blogspot.com/2008/07/mvc-how-to-write-controllers.html.

The same Noel also published the second part of “Developing iPhone applications using Ruby on Rails and Eclipse” for DeveloperWorks (part 1
and 2).

FiveRuns released a valuable gem called data_fabric which adds support for sharding and replication to Active Record. The same company also has a contest up and they’re offering two free tickets to RailsConf Europe in Berlin. Speaking of conferences, Fabio Akita announced that there will be a Rails Summit Brazil 2008 this coming October in São Paulo. This will be the first event of its kind for the Rails community in South America.

An improved version (i.e. 1.1.1) of the Oracle enhanced adapter was released, as well as version 0.9.5 of the IBM_DB adapter for DB2 and Informix, which adds support for Rails 2.1.

In purely chronological order, I found the following articles to be worth pointing out: Speed up slow Rails development in vista – a handy tip for developers using Vista, Adding Google Maps To Your Rails Applications, Live fulltext search in Ruby on Rails and Useful Flash Messages in Rails.

The Railscasts website published two new episodes, one on testing through Selenium, and another on semi-static pages.

Finally, let’s close this edition on a lighter note. The next time you are about to create an acts_as_an_evil_genius plugin or other imaginatively named one, think about this post. ;-)

If you’d like to read more updates from the Ruby side of things, please head over to This Week in Ruby.

Living on the Edge (or what's new in Edge Rails) #3

There hasn’t been much of note in terms of big changes or features in edge Rails lately, so this time I’ll leave you to pore over the Rails commit logs for any bug fixes or minor changes that I haven’t pointed out. There has been some work in progress with ActionPack refactoring and multithreading work as well as some activity in ActiveModel too, but nothing really concrete yet (still very much a work in progress).

As usual, be sure to leave any suggestions and criticisms in the comments.

Thin support with script/server

script/server now checks for the availability of Thin and uses it. Pretty convenient if you are using Thin as your production server (and want to run the same when developing). You’ll have to add config.gem 'thin' to your environment.rb first to get this to work.

This patch was contributed by one of the guys at fluxin.

Changeset

String#humanize can be customized via inflection rules

The String#humanize core extension method is used convert strings with underscore, usually table column names, in them to pretty readable text. For example,

"actor_salary".humanize
=> "Actor salary"
"anime_id".humanize
=> "Anime"

Sometimes this doesn’t work out so well though, when you have legacy tables or simply “inhumanely” named column names like “act_sal_money” (which is really “Actor salary”, but would be #humanize-d to “Act Sal Money”).

You can now specify custom inflection rules (just like you would for plural/singular/irregular/uncountable inflection rules):

Inflector.inflections do |inflect|
  inflect.human /_cnt$/, '\1_count'
  inflect.human 'act_sal_money', 'Actor Salary'
end

Notice how you can also use a regular expression above to convert columns like “click_cnt” to “Click count”.

Thumbs up to Dan Manges and Pascal Ehlert for this patch.

Changeset

Allow conditions on multiple tables to be specified using hash.

Pratik has committed a tiny (but really useful) change to ActiveRecord that allows you to specify conditions on a joined table in its own hash. An example would explain it better:

Anime.all(
  :joins => :character,
  :conditions => {
    :active => true,
    :characters => { :gender => 'female' }
  }
)

The ActiveRecord query above would find all “active” anime with “female” characters.

Changeset

Outro

That’s it for this week’s Living on the Edge – do let me know if you like to see more write-ups on even the minor bug fixes and changes that’d I’d left out this week.

This Week in Rails (June 26, 2008)

Welcome to the second edition of This Week in Rails, a weekly report with highlights from the Rails community.

Ruby Vulnerabilities

As previously reported by Jeremy Kemper, serious vulnerabilities have been discovered for the main Ruby implementations. The official advisory suggests an upgrade path, but there have been several reports of segmentation faults when using Rails with the patched Ruby 1.8.5 and 1.8.6 versions. The Phusion team has published a patch for Ruby 1.8.6-p111, but as things stand now, it hasn’t been included by the Ruby core team (yet).

If you are using Rails 2.1, Ruby 1.8.7-p22 seems the way to go. Unfortunately, Ruby 1.8.7 is not compatible with previous versions of Rails. If you decide that it’s time to upgrade your applications to Rails 2.1, this article features some handy tips, while this other one warns you about a few gotchas.

Those of you who’re running a version of Ruby that shipped with Mac OS X should wait for the next Apple’s Software Update.

Ajax

Rails is opinionated software, but its support for plugins clearly demonstrates a certain openness to diverging opinions on non-core issues. So while most of us mainly use Protoype, it is fairly common to see folks adopting other JavaScript frameworks as well, particularly jQuery.

Last week Jim Neath published a nice overview which compares jQuery with Prototype, and provides information about using jQuery with Rails through the jRails plugin.

Whatever your Ajax framework of choice is, you may be interested in the new Google Ajax Library API to improve the performance of your applications. Thanks to the tutorial Using Google Ajax Libraries API with Ruby on Rails (soon to be incorporated into a plugin) you can start adopting the API with Rails right now.

MVC

Rails 2.1 adds named scopes, which greatly simplify writing “find logic” within your Active Record models. It’s an extremely useful feature which is well explained in this write-up aptly titled, Named Scopes Are Awesome (we agree). Checkout also Ryan Bates’ railscasts on the subject: named_scope and Anonymous Scopes. You may also be interested in this week’s railscast about Caching in Rails 2.1.

Three other compelling Active Record related posts were, Smart Model, Dumb Controller, Bulk insertion of data with ActiveRecord and Timestamped Migrations on how to make “classic migrations” an available option (see ticket).

Michael Bleigh published a tutorial about dealing with subdomains in Rails applications through the SubdomainFu plugin (which appears to be flexible and very straightforward to use).

XP programming practices such as Test-Driven Development are very popular within the Rails community, but there are still many developers who see testing as a chore. Josh Nichols wrote an overview called A walk through of test-driven development with shoulda that shows you how easy it is to apply TDD to your Rails projects. In this specific case, he adopted the Shoulda plugin which seamlessly adds some assertions, helpers and macros on top of the Test::Unit framework.

Documentation

Aside from api.rubyonrails.org there are many alternatives for quickly visualizing the documentation of the Rails’ API. Last week a new one was launched: rails-doc.org. The current version features rapid searches and user annotations. This last feature in particular has the potential to become truly useful.

Deployment

If you are using Apache and mod_rails, you may want to read this article which provides information about a newly released module called apache-upload-progress.

Finally, Jason Crystal wrote a tutorial for packaging Rails applications for offline use on Mac OS X 10.5.


We’re done for this week. If you’d like to read more updates from the Ruby side of things, please head over to This Week in Ruby.

Living on the Edge (or what's new in Edge Rails) #2 - Performance improvements

The first Living on the Edge covered some of the API changes since Rails 2.1, and this time round, I’m going to cover the performance improvements as promised.

Jumping right in…

Faster Erb templates

Jeremy Kemper has made the Erb processing more efficient, especially the concat and capture helper methods.

The “special” Erb _erbout has been replaced with an instance variable, which allows for:

  • better (memory) performance because bindings are no longer being passed around,
  • fewer evals which are usually expensive,
  • there’s no need to slice the _erbout variable when you can swap in a new (string) buffer, and
  • the buffer is actually available via a output_buffer reader and writer methods (so you can override it if you want).

Relevant changesets: 933697a
- 0bdb7d3
- 4d4c8e2

Faster partials and JavaScript helpers

Partial template initialization and JavaScript helpers have been refactored and optimized for speed and efficiency by Jeremy Kemper. These are but a few of the optimizations Jeremy has been committing recently. Be sure to check out some of the commits to Rails (or for that matter, any quality Open Source project) – you could learn something!

Relevant changesets: partialsJavaScript helpers

RecordIdentifier methods speedup

The RecordIdentifier has been sped up by some simple use of memo-ization, thus reducing the number of inflections performed, among other things. The RecordIdentifier is used widely in cache keys, partial template paths, and in most places where you identify an ActiveRecord model without caring about its actual id.

Relevant changesets by Jeremy Kemper: c1a9820566d717

Lazy load cache and session stores

Update: Oops my bad, this change was later reverted in 6573f6a.

The various cache stores in the ActiveSupport::Cache module are now lazy loaded – this means that they are only required when you actually start using them.

Changeset by Pratik Naik