[LRUG] Advice: manipulating ActiveRecord objects [newbie]
Graham Ashton
graham at effectif.com
Mon Dec 14 06:50:08 PST 2015
On Mon, 14 Dec 2015, at 02:23 PM, Ed Saunders wrote:
>
> I don't think the order of the "includes" or "where" will make a difference
> though.
Agreed.
> Presumably either the FeedBuilder or ResponseBuilder is going to
> call into the FeedDetail's associations which will make that difficult.
> Without seeing those classes I'm not sure what else to suggest other than a
> potential rewrite…
This is what I was going to suggest, but I think we’d need to see what `ResponseBuilder` does to give you any actionable advice.
My gut feeling is that if I was in your shoes I’d replace `ResponseBuilder` with templates (e.g. jbuilder), and pass the results of the three fast (and simple) queries to the templates via the render call. I’m not sure what the forces are on `ResponseBuilder` (e.g. how often is it used, and what else might it interact with?) though, so I wouldn’t call it a solid suggestion just yet…
Could you share `ResponseBuilder` and `FeedBuilder` in a gist?
--
Graham Ashton (Founder, Agile Planner)
https://www.agileplannerapp.com | @grahamashton | @agileplanner
More information about the Chat
mailing list