Wednesday, October 24, 2012

Re: [Rails] Not updating the updated_at field

On Oct 24, 2012, at 6:02 AM, Peter Hickman wrote:

> The problem is that the updated_at field is useful for other functions
> but the last_seen field being updated is causing the updated_at field
> to update and records are being processed if they have been updated
> since the system was last checked (I hope I explained that correctly).
> Basically the records are being polled for changes based on the
> updated_at time. The last_seen field is causing the records to appear
> to be updated when they are not, at least not in any way that we are
> interested in.

This feels like you are mixing metaphors. The act of seeing the record is external to the record, or its current state of having been edited at a particular time. If you had a separate object that encapsulated the act of viewing one of these objects, then the max created_at of that external "I saw it" object would be your last-viewed time. This would also let you record views for other types of objects, should you need that.

Walter

>
> Creating a 'real_updated_at' field would be confusing by itself and
> require code changes to make sure that it always gets updated when
> anything but the last_seen field is updated (not a big problem I know
> but less than obvious to anyone reading the code).
>
> Another alternative that I can see is a new table for last_seen that
> has a strict one to one relationship with the master record. Which
> normalisation would say should be part of the master record, just to
> get round the updated_at field.
>
> I suspect that raw SQL will be the way round this. I was just hoping
> to make this transparent (you just know someone will see the raw SQL
> and not read the comments and 'improve' the code).
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate