{"issue":{"state":"open","created_at":"2011-11-22T00:50:40Z","updated_at":"2011-11-22T00:50:40Z","user":{"gravatar_id":"b02af94441ca54b5cab7d4ca8bfff83c","id":272709,"url":"https://api.github.com/users/fringd","avatar_url":"https://secure.gravatar.com/avatar/b02af94441ca54b5cab7d4ca8bfff83c?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"fringd"},"comments":0,"body":"i freaking love that you can do outer joins based on an association... i've been killing myself trying to make this happen...\r\n\r\nmy only hang up so far with this excellent gem is that it is hard to do *dynamic* joins...\r\n\r\nthat is, you tell me what you want joined, and i'll join it...\r\n\r\nfor example you pass me [:albums, :tracks, :format] and i give you Artist.joins{ albums.outer.tracks.outer.format.outer }\r\n\r\nor something like that.\r\n\r\nright now i'm using this code:\r\n\r\n```ruby\r\n      join = Squeel::Nodes::Join.new(joins.shift.to_sym).outer\r\n      while nextjoin = joins.shift\r\n        join = join.send(nextjoin.to_sym).outer\r\n      end\r\n      scope = scope.joins join\r\n```\r\n\r\nwhich is not really the most user_friendly... it would be nice if\r\n\r\n```ruby\r\nto_join = :albums\r\nscope.joins{ `to_join`.outer } \r\n```\r\n\r\nworked... actually that doesn't work so hot for the full string...\r\n\r\nmy intuition was to try something like\r\n\r\nscope.joins { send('albums').outer.send('tracks').outer.send('format').outer }\r\n\r\nperhaps that could be made to work?","assignee":null,"id":2312239,"number":80,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"labels":[],"title":"dynamic joins","html_url":"https://github.com/ernie/squeel/issues/80","closed_at":null,"url":"https://api.github.com/repos/ernie/squeel/issues/80","milestone":null},"action":"opened"}