Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion tracking dirty attributes
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Mitch  
View profile  
 More options Mar 11 2012, 11:49 am
From: Mitch <mitch.ll...@gmail.com>
Date: Sun, 11 Mar 2012 08:49:15 -0700 (PDT)
Local: Sun, Mar 11 2012 11:49 am
Subject: Re: tracking dirty attributes

Here's what I came up with.<https://github.com/mitchlloyd/Spine-Attribute-Events/blob/master/spin...> I'm not sure if this will work out-of-the box for normal use cases.  My
models always have an ID assigned, so I don't really mess with CIDs.

Also this doesn't really cover Peter's original use case.  All it does is
trigger events like "update:name" which is what I needed right now.

On Monday, March 5, 2012 9:42:35 PM UTC-5, Peter Ehrlich wrote:

> Hello!

> I've been doing some thinking on Spine Models, and have come to the
> conclusion that tracking attribute changes could be really cool.  

> For example, you load a resource in to spine, then navigate elsewhere, and
> come back.  But in that time the other resource has changed slightly.  So
> what you do is show the old version while loading the new version via ajax,
> and when the new version comes in, update only the correct parts of the
> page, based off of the differences between the two versions.

> It seems like this would be best handled in the active controller hooking
> to after_update on its current model.  Such a hook would show the changed
> attributes, and the controller could respond accordingly.

> This could be doubly good, because those same hooks could be used during
> regular page interactions.  For example, if you edit content on a page, the
> controller simply updates the model, and the controller's callback handles
> updating the view.  This as a coding practice would be good because it
> would enforce consistency between the saved state of the model and the sate
> of the view.

> Thoughts?
> --Peter

On Monday, March 5, 2012 9:42:35 PM UTC-5, Peter Ehrlich wrote:

> Hello!

> I've been doing some thinking on Spine Models, and have come to the
> conclusion that tracking attribute changes could be really cool.  

> For example, you load a resource in to spine, then navigate elsewhere, and
> come back.  But in that time the other resource has changed slightly.  So
> what you do is show the old version while loading the new version via ajax,
> and when the new version comes in, update only the correct parts of the
> page, based off of the differences between the two versions.

> It seems like this would be best handled in the active controller hooking
> to after_update on its current model.  Such a hook would show the changed
> attributes, and the controller could respond accordingly.

> This could be doubly good, because those same hooks could be used during
> regular page interactions.  For example, if you edit content on a page, the
> controller simply updates the model, and the controller's callback handles
> updating the view.  This as a coding practice would be good because it
> would enforce consistency between the saved state of the model and the sate
> of the view.

> Thoughts?
> --Peter


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.