У нас вы можете посмотреть бесплатно Ruby on Rails: What's The Difference Between Joins & Includes? или скачать в максимальном доступном качестве, видео которое было загружено на ютуб. Для загрузки выберите вариант из формы ниже:
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием видео, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса ClipSaver.ru
Learning Rails? Then watch this video to find out about a crucial topic. In Rails, we use models to access records in your database (like MySQL, SQLite, and PostgreSQL), these models can have relationships between them. Types of relationships: has_one has_many belongs_to If you want to use these model associations correctly, and in the most effective way possible, you need to understand two Rails ActiveRecord methods. These methods are: joins includes When you use these methods, you'll be able to join together two different models, like a blog post & it's comments, or a books & it's reviews. This allows you to filter using attributes from the associated model (like the number of review for a given product). And to display information without doing a big performance mistake. The dreaded N+1 query!!! A query which will pontentially make MILLIONS of unecessary database request, slowing everything down to a crawl. But you can avoid that by preloading related table data with "includes". Joins is a bit different. It will ONLY load records from your model which have at least one matching item in the other table. So for blog posts, this means that Post.joins(:comments), will only give you posts with AT LEAST one comment. That's the main difference! Anyway, watch the video for more examples. You can learn more by watching more of my videos now, subscribing to this channel if you haven't yet & visiting my website: https://www.rubyguides.com/ Don't forget to practice what you learned so you can remember this new knowledge. Thanks for watching!