]> git.openstreetmap.org Git - rails.git/commitdiff
Fixed precondition typo and segment_controller foreign key
authorNick Black <nickb@svn.openstreetmap.org>
Mon, 12 Mar 2007 15:49:11 +0000 (15:49 +0000)
committerNick Black <nickb@svn.openstreetmap.org>
Mon, 12 Mar 2007 15:49:11 +0000 (15:49 +0000)
app/controllers/segment_controller.rb
app/controllers/way_controller.rb
app/models/segment.rb

index 5f2603f0b37343810ee2f28a9b78e2dab8155037..58e98bef224288ec0cb5df3fff45235112f0b23a 100644 (file)
@@ -16,7 +16,7 @@ class SegmentController < ApplicationController
         segment.from_node = Node.find(segment.node_a.to_i)
         segment.to_node = Node.find(segment.node_b.to_i)
         
         segment.from_node = Node.find(segment.node_a.to_i)
         segment.to_node = Node.find(segment.node_b.to_i)
         
-        unless segment.precondtions_ok? # are the nodes visible?
+        unless segment.preconditions_ok? # are the nodes visible?
           render :nothing => true, :status => 412
         end
 
           render :nothing => true, :status => 412
         end
 
index ec8f310030a37c165f3de736f84a92a938e21aa2..fcff0fc4528678c2d760b0500ee1359738beb6ca 100644 (file)
@@ -10,7 +10,7 @@ class WayController < ApplicationController
 
       if way
         way.user_id = @user.id
 
       if way
         way.user_id = @user.id
-        unless way.precondtions_ok? # are the segments (and their nodes) visible?
+        unless way.preconditions_ok? # are the segments (and their nodes) visible?
           render :nothing => true, :status => 412
           return
         end
           render :nothing => true, :status => 412
           return
         end
index a88bc9a5b62f47e6277366a37e89adfdf3379956..785701c3d5d61761d536a0222d42cd61da768fcc 100644 (file)
@@ -8,8 +8,8 @@ class Segment < ActiveRecord::Base
   has_many :old_segments, :foreign_key => :id
   belongs_to :user
 
   has_many :old_segments, :foreign_key => :id
   belongs_to :user
 
-  has_one :from_node, :class_name => 'Node', :foreign_key => 'node_a'
-  has_one :to_node, :class_name => 'Node', :foreign_key => 'node_b'
+  has_one :from_node, :class_name => 'Node', :foreign_key => 'id'
+  has_one :to_node, :class_name => 'Node', :foreign_key => 'id'
 
   def self.from_xml(xml, create=false)
     p = XML::Parser.new
 
   def self.from_xml(xml, create=false)
     p = XML::Parser.new
@@ -103,7 +103,7 @@ class Segment < ActiveRecord::Base
     end
   end
 
     end
   end
 
-  def precondtions_ok?
+  def preconditions_ok?
     from_node and from_node.visible and to_node and to_node.visible
   end
 
     from_node and from_node.visible and to_node and to_node.visible
   end