Living on the edge (of Rails) #13 – Git script/plugin install, has_one :through

In: Edge Rails|Open Source|Ruby|Ruby on Rails

27 Mar 2008

It’s time again for some edge Rails love. If you haven’t listened to it yet, be sure to check out this week’s Rails Envy podcast

This week’s report covers changes from 17 Mar 2008 to 23 Mar 2008 (the day the corresponding Rails Envy podcast was recorded).

script/plugin install works for Git repositories

Yup you can now install plugins from Git repositories simply by running:

script/plugin install git://github.com/foo/kung_fu

What this really does is to clone a git repository (sans the entire git history by passing the —depth 1 option) into your plugins directory. If you’re looking for a Piston-like way to manage external Git repositories though, you’d still be better off with the development version of Piston (François Beausoleil, is posting frequently on his progress with adding Git support).

Credit goes to Jack Danger, a long-time Rails contributor for this patch.

Related changeset: http://dev.rubyonrails.org/changeset/9049

has_one :through

It’s been a long time coming – now you can do has_one :through (like has_many :through) for your join models. Ryan Daigle has example code on how to use it if you’re curious (though really, it’s just like has_many).

Credit goes to the Art of Mission guys and Chris O’Sullivan for pulling it all together.

Related changeset: http://dev.rubyonrails.org/changeset/9067

rake tasks time:zones:all, time:zones:us and time:zones:local

Some timezone-related rake tasks have been added to list the names of time zones recognized by the TimeZone class for the config.time_zone option you can put in your environment.rb. For example

rake time:zones:local

* UTC +08:00 *
Beijing
Chongqing
Hong Kong
Irkutsk
Kuala Lumpur
Perth
Singapore
Taipei
Ulaan Bataar
Urumqi

Credit: Geoff Buesing (core team member)

Related changeset: http://dev.rubyonrails.org/changeset/9074

#number_to_currency helper now supports a :format option

Now you can do something like:

number_to_currency(123.50, :unit => "£", :format => "%n %u") 
# => 123.50 £

Instead of being stuck with the {currency_code} {amount} format which doesn’t work in some locales (such as “42 pounds”).

Related changeset: http://dev.rubyonrails.org/changeset/9052

2 Responses to Living on the edge (of Rails) #13 – Git script/plugin install, has_one :through

Avatar

A Fresh Cup » Blog Archive » Double Shot #175

March 28th, 2008 at 7pm

[…] Living on the edge (of Rails) #13 – Git script/plugin install, has_one :through – And other changes to edge Rails. […]

Avatar

Rails Podcast Brasil - Epis?dio 11

March 28th, 2008 at 9pm

[…] Living on the edge (of Rails) #13 ? Git script/plugin install, has_one :through […]