Fixed precondition typo and segment_controller foreign key
This commit is contained in:
parent
c96b5b951c
commit
f75401ae29
3 changed files with 5 additions and 5 deletions
|
@ -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)
|
||||
|
||||
unless segment.precondtions_ok? # are the nodes visible?
|
||||
unless segment.preconditions_ok? # are the nodes visible?
|
||||
render :nothing => true, :status => 412
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ class WayController < ApplicationController
|
|||
|
||||
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
|
||||
|
|
|
@ -8,8 +8,8 @@ class Segment < ActiveRecord::Base
|
|||
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
|
||||
|
@ -103,7 +103,7 @@ class Segment < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def precondtions_ok?
|
||||
def preconditions_ok?
|
||||
from_node and from_node.visible and to_node and to_node.visible
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue