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.
+6
A:
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.
Tomas Markauskas
2010-06-24 00:38:32
A:
For code rather than markup, Ruby's notion of modules can also work the way includes work.
Ken Busch
2010-06-30 17:05:30