before_action :require_public_data, :only => [:create, :update, :delete]
before_action :check_api_writable, :only => [:create, :update, :delete]
before_action :check_api_readable, :except => [:create, :update, :delete]
before_action :require_public_data, :only => [:create, :update, :delete]
before_action :check_api_writable, :only => [:create, :update, :delete]
before_action :check_api_readable, :except => [:create, :update, :delete]
relation.create_with_history @user
render :text => relation.id.to_s, :content_type => "text/plain"
relation.create_with_history @user
render :text => relation.id.to_s, :content_type => "text/plain"
- if new_relation && new_relation.id == relation.id
- relation.update_from new_relation, @user
- render :text => relation.version.to_s, :content_type => "text/plain"
- else
- render :text => "", :status => :bad_request
+ unless new_relation && new_relation.id == relation.id
+ raise OSM::APIBadUserInput.new("The id in the url (#{relation.id}) is not the same as provided in the xml (#{new_relation.id})")
- fail OSM::APIBadUserInput.new("The parameter relations is required, and must be of the form relations=id[,id[,id...]]")
+ raise OSM::APIBadUserInput.new("The parameter relations is required, and must be of the form relations=id[,id[,id...]]")