[OSM-dev] relationships

Steve Coast steve at asklater.com
Thu Aug 16 20:49:23 BST 2007


Have been looking at the code, wicked stuff. Some notes:

nodes = Node.find(:all, :conditions => "visible = 1 and id in # 
{.......}"

can be rewritten

nodes = Node.find(array_of_ids, :conditions => 'visible = TRUE')

------------------------------
print 'blah\n'
render :nothing => true ........

can be rewritten

render :text => 'blah'

--------------------
Object.find(:first, :joins .........)

can usually be rewritten

Object.find(:first, :condiitons....., :include => [:stuff_to, :join] )

----------------------

SomeModel.user_id = user.id

is more elegant with

SomeModel.user = user


have fun,

SteveC | steve at asklater.com | http://www.asklater.com/steve/






More information about the dev mailing list