Creating consistency check for creation of nodes, way and relations. Moving some creation code from the controller to the model, and adding error handling on create errors.
This commit is contained in:
parent
127bb4523e
commit
fb5f39f19a
7 changed files with 70 additions and 44 deletions
|
@ -16,4 +16,15 @@ module ConsistencyValidations
|
|||
raise OSM::APIChangesetAlreadyClosedError.new
|
||||
end
|
||||
end
|
||||
|
||||
# This is similar to above, just some validations don't apply
|
||||
def check_create_consistency(new, user)
|
||||
if new.changeset.nil?
|
||||
raise OSM::APIChangesetMissingError.new
|
||||
elsif new.changeset.user_id != user.id
|
||||
raise OSM::APIUserChangesetMismatchError.new
|
||||
elsif not new.changeset.is_open?
|
||||
raise OSM::APIChangesetAlreadyClosedError.new
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue