[LRUG] Advice: manipulating ActiveRecord objects [newbie]

Marco Iannone marco.iannone at gmail.com
Wed Dec 16 07:56:49 PST 2015


Hi Graham,

Thanks for looking into this!

We did a little more brainstorming, and figured out another solution: the
problematic data is being loaded from DB as the user logs in (and sees a
different page), so that when they get to that page, the data will be
available. It's already in production, the speed up is quite evident.

Clearly it's a bit of kicking can down road, but we're planning a more
proper, comprehensive solution, involving loading data more granularly, as
it were.This will require a fairly major re-factor. It'll be needed as we
add a dashboard, which will require lots more data.
So, for now, being pragmatic, etc. I was hoping to disentangle some of the
activerecord magic, but not this time, it seems.

Having said that, if you like, very happy to share the entire files as
gists - let me know.

Thanks everyone again!

Cheers,
Marco







On 16 December 2015 at 13:50, Graham Ashton <graham at effectif.com> wrote:

> On Tue, 15 Dec 2015, at 12:37 PM, Marco Iannone wrote:
> >
> > Here are the gists of the responsebuilder
> > <https://gist.github.com/marcoi/c96fb66383147d096cf8>and feedbuilder
> > <https://gist.github.com/marcoi/f0202a8710700e924db2>(unnecessary stuff
> > removed). As I was mentioning the former is used everywhere, the latter
> > just here. We can build a bespoke builder.
>
> Hi Marco. `ResponseBuilder` clearly doesn’t do much, so from here onwards
> let’s ignore it.
>
> If I’ve understood it correctly, only `FeedBuilder` cares what “shape” the
> `feeds_data` object is.
>
> I wanted to see what `FeedBuilder` actually did with `feeds_data` (i.e.
> the object encapsulating the ActiveRecord query that you’re trying to
> optimise), but the gist for `FeedBuilder` doesn’t seem to contain those
> bits.
>
> I noticed the call to `.data_object_name`, Googled it, and it looks like
> you’re using Reevoo’s responsible gem to serialize stuff to JSON?
>
> https://github.com/reevoo/responsible
>
> It seems from the README that (to know what `FeedBuilder` is doing with
> the `feeds_data` variable, and therefore how you could reimplement it to
> use different objects generated from quicker queries) we'd need to see
> references (in `FeedBuilder`) to `__data__`.
>
> We’d also need to see the full list of properties (some of them might be
> delegated directly through to methods on `FeedDetail`, when the properties
> are defined).
>
> Unless there’s private data in it, I’d suggest you post the whole file.
> Can you share some of the JSON you want to produce as well?
>
>
> --
> Graham Ashton (Founder, Agile Planner)
> https://www.agileplannerapp.com | @grahamashton | @agileplanner
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> Archives: http://lists.lrug.org/pipermail/chat-lrug.org
> Manage your subscription: http://lists.lrug.org/options.cgi/chat-lrug.org
> List info: http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20151216/f21b8b68/attachment-0002.html>


More information about the Chat mailing list