Skip to content

Instantly share code, notes, and snippets.

@vishal-kajjam
Created August 4, 2011 15:55
Show Gist options
  • Save vishal-kajjam/1125504 to your computer and use it in GitHub Desktop.
Save vishal-kajjam/1125504 to your computer and use it in GitHub Desktop.
question
The possible prefetch for albums show url is
("/users/46641/albums/45103.xml", {:owner=>true, :per_page=>12, :page=>1}, {:url_prefix=>"http://staging.mobicious.com"})
this could change if we are viewing a friends album or we are logged out to
("/users/46641/albums/45103.xml", {:owner=>false, :per_page=>12, :page=>1, :hidden =>0}, {:url_prefix=>"http://staging.mobicious.com"})
("/users/46641/albums/45103.xml", {:owner=>false, :per_page=>12, :page=>1, :hidden =>0, :privacy => 0}, {:url_prefix=>"http://staging.mobicious.com"})
My question is should we prefectch all these calls as we would not know in advance which params are passed until the condition is actually called?
@medlefsen
Copy link

For now, just put the prefetch after the conditional. Try to move the conditional to as early in the action method as possible, and then put the prefetches after it. It won't be quite as fast but I think we should avoid adding extra calls for the time being.

@medlefsen
Copy link

To clarify, don't move all of the prefetches to after the conditional, just the ones that depend on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment