From 5a8c4faf3ebf4e80bd41b2f281bc3c23309739d5 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 13 Feb 2012 09:32:10 +0000 Subject: [PATCH 1/1] Replace deprecated methods with modern equivalents --- app/models/changeset_tag.rb | 2 +- app/models/language.rb | 2 +- app/models/node.rb | 2 +- app/models/node_tag.rb | 4 ++-- app/models/old_node.rb | 4 ++-- app/models/old_node_tag.rb | 4 ++-- app/models/old_relation.rb | 4 ++-- app/models/old_relation_member.rb | 4 ++-- app/models/old_relation_tag.rb | 4 ++-- app/models/old_way.rb | 4 ++-- app/models/old_way_node.rb | 4 ++-- app/models/old_way_tag.rb | 4 ++-- app/models/relation.rb | 2 +- app/models/relation_member.rb | 4 ++-- app/models/relation_tag.rb | 4 ++-- app/models/trace.rb | 2 +- app/models/tracepoint.rb | 2 +- app/models/tracetag.rb | 2 +- app/models/user_preference.rb | 3 ++- app/models/way.rb | 2 +- app/models/way_node.rb | 4 ++-- app/models/way_tag.rb | 4 ++-- 22 files changed, 36 insertions(+), 35 deletions(-) diff --git a/app/models/changeset_tag.rb b/app/models/changeset_tag.rb index bd0417ab4..0425fa6b4 100644 --- a/app/models/changeset_tag.rb +++ b/app/models/changeset_tag.rb @@ -1,5 +1,5 @@ class ChangesetTag < ActiveRecord::Base - set_primary_keys :changeset_id, :k + self.primary_keys = "changeset_id", "k" belongs_to :changeset diff --git a/app/models/language.rb b/app/models/language.rb index 7bb0b6e77..3a63176f6 100644 --- a/app/models/language.rb +++ b/app/models/language.rb @@ -1,5 +1,5 @@ class Language < ActiveRecord::Base - set_primary_key :code + self.primary_key = "code" has_many :diary_entries, :foreign_key => 'language' diff --git a/app/models/node.rb b/app/models/node.rb index 0f176067d..96d927b2c 100644 --- a/app/models/node.rb +++ b/app/models/node.rb @@ -4,7 +4,7 @@ class Node < ActiveRecord::Base include GeoRecord include ConsistencyValidations - set_table_name 'current_nodes' + self.table_name = "current_nodes" belongs_to :changeset diff --git a/app/models/node_tag.rb b/app/models/node_tag.rb index 6bc1c555e..6f1bf0388 100644 --- a/app/models/node_tag.rb +++ b/app/models/node_tag.rb @@ -1,6 +1,6 @@ class NodeTag < ActiveRecord::Base - set_table_name 'current_node_tags' - set_primary_keys :node_id, :k + self.table_name = "current_node_tags" + self.primary_keys = "node_id", "k" belongs_to :node diff --git a/app/models/old_node.rb b/app/models/old_node.rb index f8af91abb..64ae1a70c 100644 --- a/app/models/old_node.rb +++ b/app/models/old_node.rb @@ -2,8 +2,8 @@ class OldNode < ActiveRecord::Base include GeoRecord include ConsistencyValidations - set_table_name 'nodes' - set_primary_keys :node_id, :version + self.table_name = "nodes" + self.primary_keys = "node_id", "version" validates_presence_of :changeset_id, :timestamp validates_inclusion_of :visible, :in => [ true, false ] diff --git a/app/models/old_node_tag.rb b/app/models/old_node_tag.rb index cd5bc4739..eef1e02d5 100644 --- a/app/models/old_node_tag.rb +++ b/app/models/old_node_tag.rb @@ -1,6 +1,6 @@ class OldNodeTag < ActiveRecord::Base - set_table_name 'node_tags' - set_primary_keys :node_id, :version, :k + self.table_name = "node_tags" + self.primary_keys = "node_id", "version", "k" belongs_to :old_node, :foreign_key => [:node_id, :version] diff --git a/app/models/old_relation.rb b/app/models/old_relation.rb index 87771caab..a75dacd0e 100644 --- a/app/models/old_relation.rb +++ b/app/models/old_relation.rb @@ -1,8 +1,8 @@ class OldRelation < ActiveRecord::Base include ConsistencyValidations - set_table_name 'relations' - set_primary_keys :relation_id, :version + self.table_name = "relations" + self.primary_keys = "relation_id", "version" belongs_to :changeset diff --git a/app/models/old_relation_member.rb b/app/models/old_relation_member.rb index 58d7cccfb..77a5a3786 100644 --- a/app/models/old_relation_member.rb +++ b/app/models/old_relation_member.rb @@ -1,6 +1,6 @@ class OldRelationMember < ActiveRecord::Base - set_table_name 'relation_members' - set_primary_keys :relation_id, :version, :sequence_id + self.table_name = "relation_members" + self.primary_keys = "relation_id", "version", "sequence_id" belongs_to :old_relation, :foreign_key => [:relation_id, :version] # A bit messy, referring to the current tables, should do for the data browser for now diff --git a/app/models/old_relation_tag.rb b/app/models/old_relation_tag.rb index 032a87c77..49324966f 100644 --- a/app/models/old_relation_tag.rb +++ b/app/models/old_relation_tag.rb @@ -1,6 +1,6 @@ class OldRelationTag < ActiveRecord::Base - set_table_name 'relation_tags' - set_primary_keys :relation_id, :version, :k + self.table_name = "relation_tags" + self.primary_keys = "relation_id", "version", "k" belongs_to :old_relation, :foreign_key => [:relation_id, :version] diff --git a/app/models/old_way.rb b/app/models/old_way.rb index 00642cdb3..db8a6df40 100644 --- a/app/models/old_way.rb +++ b/app/models/old_way.rb @@ -1,8 +1,8 @@ class OldWay < ActiveRecord::Base include ConsistencyValidations - set_table_name 'ways' - set_primary_keys :way_id, :version + self.table_name = "ways" + self.primary_keys = "way_id", "version" belongs_to :changeset diff --git a/app/models/old_way_node.rb b/app/models/old_way_node.rb index b613be0b4..23ff503ed 100644 --- a/app/models/old_way_node.rb +++ b/app/models/old_way_node.rb @@ -1,6 +1,6 @@ class OldWayNode < ActiveRecord::Base - set_table_name 'way_nodes' - set_primary_keys :way_id, :version, :sequence_id + self.table_name = "way_nodes" + self.primary_keys = "way_id", "version", "sequence_id" belongs_to :old_way, :foreign_key => [:way_id, :version] # A bit messy, referring to current nodes and ways, should do for the data browser for now diff --git a/app/models/old_way_tag.rb b/app/models/old_way_tag.rb index 9f4adb147..9926db144 100644 --- a/app/models/old_way_tag.rb +++ b/app/models/old_way_tag.rb @@ -1,6 +1,6 @@ class OldWayTag < ActiveRecord::Base - set_table_name 'way_tags' - set_primary_keys :way_id, :version, :k + self.table_name = "way_tags" + self.primary_keys = "way_id", "version", "k" belongs_to :old_way, :foreign_key => [:way_id, :version] diff --git a/app/models/relation.rb b/app/models/relation.rb index 659c4f18a..908651b64 100644 --- a/app/models/relation.rb +++ b/app/models/relation.rb @@ -3,7 +3,7 @@ class Relation < ActiveRecord::Base include ConsistencyValidations - set_table_name 'current_relations' + self.table_name = "current_relations" belongs_to :changeset diff --git a/app/models/relation_member.rb b/app/models/relation_member.rb index c1919b67a..aba38511c 100644 --- a/app/models/relation_member.rb +++ b/app/models/relation_member.rb @@ -1,6 +1,6 @@ class RelationMember < ActiveRecord::Base - set_table_name 'current_relation_members' - set_primary_keys :relation_id, :sequence_id + self.table_name = "current_relation_members" + self.primary_keys = "relation_id", "sequence_id" belongs_to :relation belongs_to :member, :polymorphic => true diff --git a/app/models/relation_tag.rb b/app/models/relation_tag.rb index 2773d0612..c665cfef6 100644 --- a/app/models/relation_tag.rb +++ b/app/models/relation_tag.rb @@ -1,6 +1,6 @@ class RelationTag < ActiveRecord::Base - set_table_name 'current_relation_tags' - set_primary_keys :relation_id, :k + self.table_name = "current_relation_tags" + self.primary_keys = "relation_id", "k" belongs_to :relation diff --git a/app/models/trace.rb b/app/models/trace.rb index 3f58cee2e..b72fda07d 100644 --- a/app/models/trace.rb +++ b/app/models/trace.rb @@ -1,5 +1,5 @@ class Trace < ActiveRecord::Base - set_table_name 'gpx_files' + self.table_name = "gpx_files" belongs_to :user has_many :tags, :class_name => 'Tracetag', :foreign_key => 'gpx_id', :dependent => :delete_all diff --git a/app/models/tracepoint.rb b/app/models/tracepoint.rb index d4ba39de3..c4ad8e123 100644 --- a/app/models/tracepoint.rb +++ b/app/models/tracepoint.rb @@ -1,7 +1,7 @@ class Tracepoint < ActiveRecord::Base include GeoRecord - set_table_name 'gps_points' + self.table_name = "gps_points" validates_numericality_of :trackid, :only_integer => true validates_numericality_of :latitude, :only_integer => true diff --git a/app/models/tracetag.rb b/app/models/tracetag.rb index f9833e141..d30d9d5ab 100644 --- a/app/models/tracetag.rb +++ b/app/models/tracetag.rb @@ -1,5 +1,5 @@ class Tracetag < ActiveRecord::Base - set_table_name 'gpx_file_tags' + self.table_name = "gpx_file_tags" validates_format_of :tag, :with => /^[^\/;.,?]*$/ validates_length_of :tag, :within => 1..255 diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb index 28ef40f1d..b5110bbf5 100644 --- a/app/models/user_preference.rb +++ b/app/models/user_preference.rb @@ -1,5 +1,6 @@ class UserPreference < ActiveRecord::Base - set_primary_keys :user_id, :k + self.primary_keys = "user_id", "k" + belongs_to :user validates_length_of :k, :within => 1..255 diff --git a/app/models/way.rb b/app/models/way.rb index 85aca4334..f1c46abf3 100644 --- a/app/models/way.rb +++ b/app/models/way.rb @@ -3,7 +3,7 @@ class Way < ActiveRecord::Base include ConsistencyValidations - set_table_name 'current_ways' + self.table_name = "current_ways" belongs_to :changeset diff --git a/app/models/way_node.rb b/app/models/way_node.rb index 1a2e6928a..30d901356 100644 --- a/app/models/way_node.rb +++ b/app/models/way_node.rb @@ -1,6 +1,6 @@ class WayNode < ActiveRecord::Base - set_table_name 'current_way_nodes' - set_primary_keys :way_id, :sequence_id + self.table_name = "current_way_nodes" + self.primary_keys = "way_id", "sequence_id" belongs_to :way belongs_to :node diff --git a/app/models/way_tag.rb b/app/models/way_tag.rb index f0c5eea8b..98ff62f5f 100644 --- a/app/models/way_tag.rb +++ b/app/models/way_tag.rb @@ -1,6 +1,6 @@ class WayTag < ActiveRecord::Base - set_table_name 'current_way_tags' - set_primary_keys :way_id, :k + self.table_name = "current_way_tags" + self.primary_keys = "way_id", "k" belongs_to :way -- 2.39.5