Changelog History
Page 1
-
v0.5.0
May 04, 2016 -
v0.4.0
February 06, 2016 -
v0.3.5 Changes
January 06, 2015- โ Removed unnecessary call to
respond_to
sinceresponders
have been removed from Rails.
- โ Removed unnecessary call to
-
v0.3.4 Changes
January 06, 2015#squish
generated HTML- ๐ Fix bug when using
sync @resource
with the:scope
option
-
v0.3.3
December 30, 2014 -
v0.3.0 Changes
March 03, 2014๐ This release focuses on improving and extending the model DSL for setting up automatic syncing in advanced use cases.
- โ Adds the ability for advanced channel scoping
There were multiple feature requests asking for a way to sync differently scoped lists of the same model automatically and interdependently (e.g all todos of a user and all todos of a project). This can now be accomplished by explicitly defining scopes on the model via the new
sync_scope
method:class Todo < ActiveRecord::Base belongs_to :project belongs_to :user sync :all sync_scope :by_user(user), -> { where(user_id: user.id) } sync_scope :by_project(project), -> { where(project_id: project.id) } end
and then use these scopes to narrow the rendering of sync partials like this:
<%= sync partial: "todo", resource: Todo.by_user(@user) %> <%= sync_new partial: "todo", resource: Todo.new, scope: Todo.by_user(@user) %>
Please take a look at the docs and the readme for a more thorough explanation and examples on how to use this new feature.
- โ Adds the ability to explicitly update parent associations via
sync_touch
Breaking Changes:
- ๐ If you're using the scope feature to narrow the syncing of new records in the
sync_new
call, you will now have to add this scope when calling thesync
helper method as well:
<%= sync partial: 'todo_comment', collection: @comments, scope: @todo %> <%= sync_new partial: 'todo_comment', resource: Comment.new, scope: @todo %>
If you're in addition using the controller way of manually syncing partials, you will now also have to add the scope parameter to the sync_destroy call like this:
sync_destroy @comment, scope: @comment.todo
Why is this?
Before this version there was only a global destroy channel for every record, so an unscoped
sync_destroy
call was just enough to remove all partials from all subscribed clients when a record has been destroyed. As of 0.3.0 the destroy channel will be used not only to remove partials when a record is destroyed, but also when partials for that record need to be added to/removed from different sets throughout the application when it is updated.- โก๏ธ The
:scope
parameter for thesync
method has been replaced with:default_scope
. Make sure you update your code accordingly. If you're using the default scope feature, be sure to alway add the corresponding option to your views like this:
class Todo < ActiveRecord::Base belongs_to :organization sync :all, default_scope: :organization end
<%= sync partial: "todo", resource: @todos, default_scope: @organization %> <%= sync_new partial: "todo", resource: Todo.new, default_scope: @organization %>
- โก๏ธ The parent model defined by the
:default_scope
parameter will no longer be automatically updated via sync. Please use the new explicitsync_touch
method instead.
Old Syntax:
class Todo < ActiveRecord::Base belongs_to :project belongs_to :user sync :all, scope: :project end
New Syntax:
class Todo < ActiveRecord::Base belongs_to :project belongs_to :user sync :all, default_scope: :project sync_touch :project, :user end
This will sync all partials of the parent model
project
anduser
, whenever a todo is created/updated/deleted. -
v0.2.7 Changes
- ๐ Fixes https://github.com/chrismccord/sync/issues/54 (Thin complaining about too long query string)
-
v0.2.6
September 12, 2013 -
v0.2.3 Changes
June 30, 2013- ๐ Fixed Turbolinks issue where
page:restore
events no longer evaluate script tags in the body. The workaround re-evaluates all sync sript tags on page restore.
- ๐ Fixed Turbolinks issue where
-
v0.2.2
May 29, 2013