Rendering View Collections in Ruby on Rails

preview_player
Показать описание
When building Rails views, a very common task is to iterate over a collection of objects, and render a partial for each of these objects:
  (%= render partial: "product", locals: { product: product } %)
(% end %)
Though, we can achieve the same result with a shorter version:
(%= render partial: "product", collection: @products %)
Impressive, right?
But with a little extra Rails Magic, we achieve the same result with an even shorter version:
(%= render @products %)

💻 Follow for more programming videos 💻

#ruby #programming #computerscience #webdevelopment #softwareengineer #rubyonrails #rubydeveloper #rubyonrailsdeveloper
Рекомендации по теме