Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Includes in Ruby on Rails?

Ive been learning PHP and tried to get into RoR and the two are always compared.My question is, is there a PHP include equivalent for Ruby on Rails. To me the ability to include PHP files is it's most valuable feature.

like image 303
ThomasReggi Avatar asked Jul 03 '26 17:07

ThomasReggi


1 Answers

PHP is a programming language while Ruby on Rails is a framework therefore you're comparing two completely different things.

Assuming that you use include in PHP to build a page from many nested templates/scripts then partials would be the way to go in Rails, e.g.:

<%= render :partial => 'sidebar' %>

Ruby itself has also require which behaves similar to include or require in PHP but it doesn't work for views in Rails.

like image 172
Tomas Markauskas Avatar answered Jul 06 '26 08:07

Tomas Markauskas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!