Answer the question
In order to leave comments, you need to log in
Need help identifying a fastener?
and so the fasteners were broken, I want to order a new one, but I don’t know what it’s called here is a photo and
if there is, give links to Ali
Answer the question
In order to leave comments, you need to log in
# AR
Order.where(store_id: var).group(:created_at).sum(:total_price)
# Scope
scope :sum_orders, -> (var) { where(store_id: var).group(:created_at).sum(:total_price) }
In my opinion, it is easier to rewrite it on rails.
In the scope method, I think you can arrange this whole thing yourself, so that it is beautiful, like
raw sql in rails is needed when everything is very, very bad.
So bad that the query cannot be written, for example, in the same arel table. It must be a very specific animal. Everything else is easy to sign through ActiveRecord without much effort.
Go to the auto shop, to the department where they sell card clips.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question