views:

83

answers:

3

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.

+2  A: 

I believe the closest equivalent would be utilizing :partial

Ian
+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
A: 

For code rather than markup, Ruby's notion of modules can also work the way includes work.

Ken Busch