gem "bootstrap", :github => "gravitystorm/bootstrap-rubygem", :branch => "dartsass_5_2_3"
gem "bootstrap_form", "~> 5.0"
gem "cancancan"
-# gem "composite_primary_keys", "~> 14.0.0"
gem "config"
gem "delayed_job_active_record"
gem "frozen_record"
#
class ChangesetTag < ApplicationRecord
- self.primary_keys = "changeset_id", "k"
-
belongs_to :changeset
validates :changeset, :associated => true
#
class DiaryEntrySubscription < ApplicationRecord
- self.primary_keys = "user_id", "diary_entry_id"
-
belongs_to :user
belongs_to :diary_entry
end
class NodeTag < ApplicationRecord
self.table_name = "current_node_tags"
- self.primary_keys = "node_id", "k"
belongs_to :node
include ConsistencyValidations
self.table_name = "nodes"
- self.primary_keys = "node_id", "version"
# NOTE: this needs to be included after the table name changes, or
# the queries generated by Redactable will use the wrong table name.
belongs_to :redaction, :optional => true
belongs_to :current_node, :class_name => "Node", :foreign_key => "node_id", :inverse_of => :old_nodes
- has_many :old_tags, :class_name => "OldNodeTag", :foreign_key => [:node_id, :version], :inverse_of => :old_node
+ has_many :old_tags, :class_name => "OldNodeTag", :query_constraints => [:node_id, :version], :inverse_of => :old_node
def validate_position
errors.add(:base, "Node is not in the world") unless in_world?
#
# Foreign Keys
#
-# node_tags_id_fkey (node_id => nodes.node_id)
+# node_tags_id_fkey (["node_id", "version"] => nodes.["node_id", "version"])
#
class OldNodeTag < ApplicationRecord
self.table_name = "node_tags"
- self.primary_keys = "node_id", "version", "k"
- belongs_to :old_node, :foreign_key => [:node_id, :version], :inverse_of => :old_tags
+ belongs_to :old_node, :query_constraints => [:node_id, :version], :inverse_of => :old_tags
validates :old_node, :associated => true
validates :k, :v, :allow_blank => true, :length => { :maximum => 255 }, :characters => true
include ConsistencyValidations
self.table_name = "relations"
- self.primary_keys = "relation_id", "version"
# NOTE: this needs to be included after the table name changes, or
# the queries generated by Redactable will use the wrong table name.
belongs_to :redaction, :optional => true
belongs_to :current_relation, :class_name => "Relation", :foreign_key => "relation_id", :inverse_of => :old_relations
- has_many :old_members, -> { order(:sequence_id) }, :class_name => "OldRelationMember", :foreign_key => [:relation_id, :version], :inverse_of => :old_relation
- has_many :old_tags, :class_name => "OldRelationTag", :foreign_key => [:relation_id, :version], :inverse_of => :old_relation
+ has_many :old_members, -> { order(:sequence_id) }, :class_name => "OldRelationMember", :query_constraints => [:relation_id, :version], :inverse_of => :old_relation
+ has_many :old_tags, :class_name => "OldRelationTag", :query_constraints => [:relation_id, :version], :inverse_of => :old_relation
validates :changeset, :associated => true
validates :timestamp, :presence => true
#
# Foreign Keys
#
-# relation_members_id_fkey (relation_id => relations.relation_id)
+# relation_members_id_fkey (["relation_id", "version"] => relations.["relation_id", "version"])
#
class OldRelationMember < ApplicationRecord
self.table_name = "relation_members"
- self.primary_keys = "relation_id", "version", "sequence_id"
+ self.primary_key = %w[relation_id version sequence_id]
- belongs_to :old_relation, :foreign_key => [:relation_id, :version], :inverse_of => :old_members
+ belongs_to :old_relation, :query_constraints => [:relation_id, :version], :inverse_of => :old_members
# A bit messy, referring to the current tables, should do for the data browser for now
belongs_to :member, :polymorphic => true
#
# Foreign Keys
#
-# relation_tags_id_fkey (relation_id => relations.relation_id)
+# relation_tags_id_fkey (["relation_id", "version"] => relations.["relation_id", "version"])
#
class OldRelationTag < ApplicationRecord
self.table_name = "relation_tags"
- self.primary_keys = "relation_id", "version", "k"
- belongs_to :old_relation, :foreign_key => [:relation_id, :version], :inverse_of => :old_tags
+ belongs_to :old_relation, :query_constraints => [:relation_id, :version], :inverse_of => :old_tags
validates :old_relation, :associated => true
validates :k, :v, :allow_blank => true, :length => { :maximum => 255 }, :characters => true
include ConsistencyValidations
self.table_name = "ways"
- self.primary_keys = "way_id", "version"
# NOTE: this needs to be included after the table name changes, or
# the queries generated by Redactable will use the wrong table name.
belongs_to :redaction, :optional => true
belongs_to :current_way, :class_name => "Way", :foreign_key => "way_id", :inverse_of => :old_ways
- has_many :old_nodes, :class_name => "OldWayNode", :foreign_key => [:way_id, :version], :inverse_of => :old_way
- has_many :old_tags, :class_name => "OldWayTag", :foreign_key => [:way_id, :version], :inverse_of => :old_way
+ has_many :old_nodes, :class_name => "OldWayNode", :query_constraints => [:way_id, :version], :inverse_of => :old_way
+ has_many :old_tags, :class_name => "OldWayTag", :query_constraints => [:way_id, :version], :inverse_of => :old_way
validates :changeset, :associated => true
validates :timestamp, :presence => true
#
# Foreign Keys
#
-# way_nodes_id_fkey (way_id => ways.way_id)
+# way_nodes_id_fkey (["way_id", "version"] => ways.["way_id", "version"])
#
class OldWayNode < ApplicationRecord
self.table_name = "way_nodes"
- self.primary_keys = "way_id", "version", "sequence_id"
- belongs_to :old_way, :foreign_key => [:way_id, :version], :inverse_of => :old_nodes
+ belongs_to :old_way, :query_constraints => [:way_id, :version], :inverse_of => :old_nodes
# A bit messy, referring to current nodes and ways, should do for the data browser for now
belongs_to :node
belongs_to :way
#
# Foreign Keys
#
-# way_tags_id_fkey (way_id => ways.way_id)
+# way_tags_id_fkey (["way_id", "version"] => ways.["way_id", "version"])
#
class OldWayTag < ApplicationRecord
self.table_name = "way_tags"
- self.primary_keys = "way_id", "version", "k"
- belongs_to :old_way, :foreign_key => [:way_id, :version], :inverse_of => :old_tags
+ belongs_to :old_way, :query_constraints => [:way_id, :version], :inverse_of => :old_tags
validates :old_way, :associated => true
validates :k, :v, :allow_blank => true, :length => { :maximum => 255 }, :characters => true
class RelationMember < ApplicationRecord
self.table_name = "current_relation_members"
- self.primary_keys = "relation_id", "sequence_id"
+ self.primary_key = %w[relation_id sequence_id]
belongs_to :relation
belongs_to :member, :polymorphic => true
class RelationTag < ApplicationRecord
self.table_name = "current_relation_tags"
- self.primary_keys = "relation_id", "k"
belongs_to :relation
#
class UserPreference < ApplicationRecord
- self.primary_keys = "user_id", "k"
-
belongs_to :user
validates :user, :associated => true
class WayNode < ApplicationRecord
self.table_name = "current_way_nodes"
- self.primary_keys = "way_id", "sequence_id"
belongs_to :way
belongs_to :node
class WayTag < ApplicationRecord
self.table_name = "current_way_tags"
- self.primary_keys = "way_id", "k"
belongs_to :way
xml = "<osm><node lat='#{lat}' lon='#{lon}' changeset='#{changeset.id}'><tag k='foo' v='#{'x' * 256}'/></node></osm>"
put node_create_path, :params => xml, :headers => auth_header
assert_response :bad_request, "node upload did not return bad_request status"
- assert_equal ["NodeTag ", " v: is too long (maximum is 255 characters) (\"#{'x' * 256}\")"], @response.body.split(/[0-9]+,foo:/)
+ assert_match(/ v: is too long \(maximum is 255 characters\) /, @response.body)
end
def test_show