Trong bản cập nhật mới nhất của, Rails 7.1 đã cho phép chúng ta query select theo giá trị hash chứ không cần phải sử dụng raw SQL nữa.
💎 Improvements:
1️⃣ New support query với giá trị Hash
2️⃣ Chúng ta không cần phải dùng truy vấn raw version nữa
💎 Bonus:
1️⃣ Cú pháp mới cũng support chúng ta sử dụng alias
2️⃣ Sử dụng tương tự cho ActiveRecord#reselect
Ruby
# Before Rails 7.1
Post.joins(:comments)
.select(
"posts.id as post_id, posts.title as post_title,
comments.id as comment_id, comments.body as comment_body"
)
Post.joins(:comments).select(:id, :title, "comments.body")
# After Rails 7.1
Post.joins(:comments)
.select(
posts: { id: :post_id, title: :post_title },
comments: { id: :comments_id, body: :comment_body }
)
Post.joins(:comments).select(:id, :title, comments: [:body] )
10 comments
Тryіng to find a affordable рainting contraϲtor? Let
us tell yߋu about one that stands out: **Cook’s Simρⅼe Painting**.
Appreciate the post — but if you’re looking for real thca options,
try Get Seeds Right Here Get Clones Right Here.
Solid writeup. Just got fresh cuts from Get Seeds Right Here Get Clones Right Here,
worth checking.
getseedsrighthere.com is my baseline for marijuana clone research.
Your article helped me a lot, is there any more related content? Thanks! https://www.binance.com/register?ref=IXBIAFVY
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article. https://accounts.binance.com/register/person?ref=IHJUI7TF
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.
Hi there, i read yolur blolg from ime tto time aand i ownn a simmilar onne and i waas jyst cudious iif yoou
gget a lot off spam comments? If soo hhow ddo youu reducxe it,
any pougin oor anytthing yoou cann suggest? I gett
sso mch latly it’s riving me insan so aany supportt iss vsry
muc appreciated.
my weeb page – redwap.pro