I
I
Ilnar252018-02-26 23:12:41
Ruby on Rails
Ilnar25, 2018-02-26 23:12:41

How to correctly form a request for rails?

Two models. User(has_many :orders) and Order(belongs_to :user). How to beautifully and briefly form an sql query to get the Order model with its attributes, adding user.name to them. For a request, we have a value for order.id.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
blackst0ne, 2018-02-27
@blackst0ne

Under to form sql request crude SQL or the ActiveRecord-construction mean?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question