Skip to content

Instantly share code, notes, and snippets.

View PericlesTheo's full-sized avatar
👋
I will eventually write something on my blog

Pericles Theodorou PericlesTheo

👋
I will eventually write something on my blog
View GitHub Profile
def show
@article = Article.find(params[:id])
if stale?(etag: @article, last_modified: @article.created_at)
@statistics = @article.really_expensive_call
render json: @article
end
end
user = User.last
user.updated_at
#=> Fri, 15 Jun 2018 16:00:02 BST +01:00
user.update(email: "abc@gmail.com")
user.updated_at
#=> Fri, 22 Jun 2018 11:08:03 BST +01:00
user.reload!
user.update_column(:email, "def@gmail.com")