DEV Community

dmacinto
dmacinto

Posted on

AppDev Week 8

AppDev Week 8

N+1 problem - frequent requests to the database where you also call at the associates

eager loading - pull database once to work with

includes() method in the each do loop to note what to load

queries are where most of hte time improvements can be made

bullet gem can give a warning for N+1 problems

cache-ing - precomputing to save and show later

<% cache “hello” do %>

<% end %>

need to be enabled by rails dev:cache

middle term in the cache statement is the cache key
every time the key is changed, rails will update the cached

in hte belong_to, you can update touch:true to use the parent object as the cache key

kaminari gem used for pagnetnation

API Stuff

jbuilder

json.set!(:hello, “Hello World!”)

or json.hello(“world”)

nested hashes

json.hell(“world”) do

end

React-native demo

View is like div

yarn start --tunnel to start apps on expo

Top comments (0)