move potlatch presets to only be generated once, and allow pulling in way_tags in a way via a false primary key

This commit is contained in:
Steve Coast 2008-01-24 10:52:10 +00:00
parent 602b7b6d3f
commit 3bd92c1670
6 changed files with 88 additions and 66 deletions

View file

@ -49,9 +49,10 @@ class Way < ActiveRecord::Base
# Find a way given it's ID, and in a single SQL call also grab its nodes
#
# You can't pull in all the tags too unless we put a sequence_id on the way_tags table and have a multipart key
def self.find_eager(id)
way = Way.find(id, :include => {:way_nodes => :node})
way = Way.find(id, :include => [:way_tags, {:way_nodes => :node}])
end
# Find a way given it's ID, and in a single SQL call also grab its nodes and tags

View file

@ -3,4 +3,6 @@ class WayNode < ActiveRecord::Base
set_primary_keys :id, :sequence_id
belongs_to :node
belongs_to :way, :foreign_key => :id
end

View file

@ -1,5 +1,8 @@
class WayTag < ActiveRecord::Base
set_table_name 'current_way_tags'
# false multipart key
set_primary_keys :id, :k, :v
belongs_to :way, :foreign_key => 'id'
end