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

Tom Hughes notifications at github.com
Fri Jul 25 14:05:58 UTC 2014


> @@ -36,8 +41,10 @@ def create
>    # Return XML giving the basic info about the changeset. Does not
>    # return anything about the nodes, ways and relations in the changeset.
>    def read
> -    changeset = Changeset.find(params[:id])
> -    render :text => changeset.to_xml.to_s, :content_type => "text/xml"
> +    @changeset = Changeset.find(params[:id])
> +    @comments = params['include_discussion'].presence ? @changeset.comments.includes(:author) : false

That looks bogus - you have a ternary operator with one branch returning an array and the other returning a boolean. Suggest the else should return an empty array, or perhaps more likely `nil`. In fact I'd suggest writing it in a much more readable way as:

```
@comments = @changeset.comments.includes(:author) if params[:include_discussion].presence
```

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


More information about the rails-dev mailing list