Slide 26
Slide 26 text
Q3. Querying exists? in loop
# A
current_user = User.find(42)
can_update = current_user
.permissions
.exists?(action: :update)
response = Article.all.map do
{
title: _1.title,
can_update:,
}
end
# B
current_user = User.find(42)
response = Article.all.map do
can_update = current_user
.permissions
.exists?(action: :update)
{
title: _1.title,
can_update:,
}
end