[PageOneX] [dev] Should we simplify the data model?

pablo rey pablo at basurama.org
Thu Feb 14 09:24:30 EST 2013


Hi,
Good idea to clean first the data model.

On Wed, Feb 13, 2013 at 5:32 PM, Edward Platt <elplatt at media.mit.edu> wrote:

> Hi All,
>
> I've mapped out the data model of PageOneX.  In the attached png, an arrow
> represents a "has_one / belongs_to" relationship and a double arrow
> represents a "has_many / belongs_to" relationship.
>
Great to understand the structure. Thanks!

>
> It looks like threadx_image and image_codes are redundant, as well as the
> direct association between threadx and highlighted_area.
>
I agree.

I think there is at least one link missing: the association between
highlighted_area and user. The user has_many :highlighted_areas. (maybe
with area directly). I guess it is not redundant, as it is important to
know who has drawn what in a multi-user thread.


>
> There seems to be a danger of things getting out of sync.  For instance,
> if I understand things correctly, the following two commands should return
> the same thing:
>
> HighlightedArea.joins(:code => :threadx).where('threadxes.id = ?',
> thread.id).length
> # => 6
> thread.highlighted_areas.length
> # => 237
>
> Mmm, I do not fully understand the expression to evaluate it :(


> Pablo, do you know if there was a reason for creating these redundant
> associations and models?  Should we remove them?
>
> As far as I understand, it is fine to remove those associations and
models.

I was looking at the post that documented the data model
http://montera34.org/pageonex/2012/06/22/pageonex-initial-data-model/ but
it is not clear why those associations were needed.

p


> -Ed
> --
> Edward L. Platt
> Civic Technology Programmer
> MIT Center for Civic Media
> E15-348
> http://civic.mit.edu
> http://elplatt.com
> @EdwardLPlatt <http://twitter.com/edwardlplatt>
>
> _______________________________________________
> Pageonexdev mailing list
> Pageonexdev at mit.edu
> http://mailman.mit.edu/mailman/listinfo/pageonexdev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/mailman/private/pageonexdev/attachments/20130214/64d35915/attachment.htm


More information about the Pageonexdev mailing list