Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
"Re-salvar" todos os registros de determinado model no console do rails (para que executem algum novo before_filter, por exemplo)
News.find_each(&:save)
Owner

Godoy commented Jan 2, 2017

Resetar contadores counter_cache: Post.all.each { |p| Post.reset_counters(p.id, :comments) }

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