[openstreetmap/openstreetmap-website] Simplify partial rendering when the partial is named after the model (#2278)

Andy Allan notifications at github.com
Wed Jun 26 12:19:03 UTC 2019


During review of #2207 I realised that we can simplify a bunch of our partial calls. For example, if @trace is a `Trace` model, then instead of:

```
<%= render :partial => "trace", :object => @trace %>
```
... you can instead call...
```
<%= render @trace %>
```
... and Rails will find the partial named after the model, and pass the object into the partial automatically. It also works with collections.
You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/openstreetmap-website/pull/2278

-- Commit Summary --

  * Simplify partial rendering when the partial is named after the model

-- File Changes --

    M app/views/api/notes/index.gpx.builder (2)
    M app/views/api/notes/index.json.jsonify (2)
    M app/views/api/notes/index.rss.builder (2)
    M app/views/api/notes/index.xml.builder (2)
    M app/views/api/notes/show.gpx.builder (2)
    M app/views/api/notes/show.json.jsonify (2)
    M app/views/api/notes/show.rss.builder (2)
    M app/views/api/notes/show.xml.builder (2)
    M app/views/api/users/index.builder (2)
    M app/views/api/users/show.builder (2)
    D app/views/diary_entries/_diary_index_entry.html.erb (1)
    M app/views/diary_entries/index.html.erb (6)
    M app/views/diary_entries/show.html.erb (2)
    D app/views/redactions/_redactions.html.erb (3)
    M app/views/redactions/index.html.erb (4)
    M app/views/traces/index.html.erb (2)
    M app/views/users/index.html.erb (2)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/2278.patch
https://github.com/openstreetmap/openstreetmap-website/pull/2278.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/2278
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20190626/b55dfa95/attachment.html>


More information about the rails-dev mailing list