Skip to content

Instantly share code, notes, and snippets.

@Godoy
Created September 14, 2013 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Godoy/6564097 to your computer and use it in GitHub Desktop.
Save Godoy/6564097 to your computer and use it in GitHub Desktop.
"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)
@Godoy
Copy link
Author

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