[openstreetmap-website] Changeset discussion feature (#772)

Tom Hughes notifications at github.com
Fri Jul 25 14:15:32 UTC 2014


> @@ -305,6 +312,146 @@ def feed
>      list
>    end
>  
> +  ##
> +  # Add a comment to a changeset
> +  def comment
> +    # Check the arguments are sane
> +    raise OSM::APIBadUserInput.new("No id was given") unless params[:id]
> +    raise OSM::APIBadUserInput.new("No text was given") if params[:text].blank?
> +
> +    # Extract the arguments
> +    id = params[:id].to_i
> +    body = params[:text]
> +
> +    # Find the changeset and check it is valid
> +    @changeset = Changeset.find(id)
> +    raise OSM::APINotFoundError unless @changeset

You shouldn't need this - the `find` call will raise `ActiveRecord::RecordNotFound` anyway if the id doesn't exist.

---
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/772/files#r15402396
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20140725/e8b3ed9e/attachment.html>


More information about the rails-dev mailing list