Is the downloaded download the same as the extraction?

Is fetch expected as well as connection choice?

I mean, can impatiently receive a has-many relationship cause 2 requests or one connection request?

How does an active record in rails implement association extraction associations because they don't know the table metadata first hand (I mean the columns in the table)? Say for example, I have

people - id, name things - id, person_id, name

man has a one-to-many relationship with things. So, how does it generate a query with all the column aliases, even if he cannot know it when I do data collection for people?

+3
source share
2 answers

, , :

  • " , ?"

SQL- , ActiveRecord:: Base. "", , "". - . , .

  • ", , ?"

, sql, , , . , Rails ( SQL) , main table join , sql. (, Human.join(: pets).where("people.name = 'John'))

  • " , has-many 2 ?"

Rails . , . , , , , . , , . , Rails 3, , , , , , .

+3

. Ruby , / , . "person_id", "own_to: person" , "person_id" - , , "".

People.includes(: things), 2 , 1 , , , .

http://guides.rubyonrails.org/active_record_querying.html

+1

All Articles