|
| 1 | +# Version 0.2.1 - May 27, 2013 |
| 2 | + |
| 3 | + - Add ability to narrow scope to custom channel for sync_new publishes |
| 4 | + |
| 5 | +Example Usage: |
| 6 | + |
| 7 | +View: |
| 8 | +```erb |
| 9 | +<%= sync_new partial: 'todo_list_row', resource: Todo.new, scope: [@project, :staff] %> |
| 10 | +``` |
| 11 | + |
| 12 | +Controller/Model: |
| 13 | +```ruby |
| 14 | +sync_new @todo, scope: [@project, :staff] |
| 15 | +``` |
| 16 | + |
| 17 | + |
| 18 | +# Version 0.2.0 - May 26, 2013 |
| 19 | + |
| 20 | + - Add ability to refetch partial from server to render within session context, ref: https://github.com/chrismccord/sync/issues/44 |
| 21 | + |
| 22 | +This solves the issues of syncing partials across different users when the partial requires the session's context (ie. current_user). |
| 23 | + |
| 24 | +Ex: |
| 25 | + View: Add `refetch: true` to sync calls, and place partial file in a 'refetch' |
| 26 | + subdirectory in the model's sync view folder: |
| 27 | + |
| 28 | +The partial file would be located in `app/views/sync/todos/refetch/_list_row.html.erb` |
| 29 | +```erb |
| 30 | +<% @project.todos.ordered.each do |todo| %> |
| 31 | + <%= sync partial: 'list_row', resource: todo, refetch: true %> |
| 32 | +<% end %> |
| 33 | +<%= sync_new partial: 'list_row', resource: Todo.new, scope: @project, refetch: true %> |
| 34 | +``` |
| 35 | + |
| 36 | +*Notes* |
| 37 | +While this approach works very well for the cases it's needed, syncing without refetching should be used unless refetching is absolutely necessary for performance reasons. For example, |
| 38 | + |
| 39 | +A sync update request is triggered on the server for a 'regular' sync'd partial with 100 listening clients: |
| 40 | +- number of http requests 1 |
| 41 | +- number of renders 1, pushed out to all 100 clients via pubsub server. |
| 42 | + |
| 43 | + |
| 44 | +A sync update request is triggered on the server for a 'refetch' sync'd partial with 100 listening clients: |
| 45 | +- number of http requests 100 |
| 46 | +- number of renders 100, rendering each request in clients session context. |
0 commit comments