jest
jest

Reputation: 699

How are Ruby and Rails related?

First of all, i want some clarification :)

1) Is RoR like a server scripting language?

2) Can it be used as an alternative to php?

I started learning Ruby from The Ruby Programming Language book and haven't yet come across something which relates to the web. Is Ruby for desktop apps and Rails for web apps?

Thanks

Upvotes: 5

Views: 548

Answers (5)

Arnis Lapsa
Arnis Lapsa

Reputation: 47647

ruby - dynamic programming language
ruby on rails - framework for creating web apps written in ruby

Upvotes: 9

John Topley
John Topley

Reputation: 115412

  • Ruby is a general-purpose, dynamic, object-oriented scripting language
  • Ruby on Rails is a web framework that's written in Ruby

Rails' ActiveSupport module also enhances Ruby in certain ways by adding capabilities to some of Ruby's built-in classes. Rails depends on Ruby, but Ruby doesn't depend on Rails.

Upvotes: 2

Simone Carletti
Simone Carletti

Reputation: 176552

  1. Not Really. Ruby on Rails is a web application framework written in Ruby. If you need a comparison, Ruby on Rails is for Ruby what Zend Framework, CakePHP or Symfony are for PHP.

  2. Neither Ruby nor Ruby on Rails are real alternatives to PHP. PHP is a programming language focused on web applications. Ruby is a pure programming language which can be used for creating web applications.

Ruby on Rails offers a more high-level approach for writing web applications with Ruby. Ruby offers some low-level CGI libraries you can use to interact with web servers, but it requires much more effort compared to PHP (because again, PHP is a web-focused language). For this reason, almost nobody writes web application in Ruby without using a framework such as Rails, Sinatra or others.

Upvotes: 0

Fenton
Fenton

Reputation: 251242

Ruby is a language - and one that encourages (some might say enforces) object-oriented programming.

Rails is a framework for writing applications and it uses the Ruby language - hence the term "Ruby on Rails".

Upvotes: 2

Leonid Shevtsov
Leonid Shevtsov

Reputation: 14189

Ruby is an all-purpose scripting language. There are GUI toolkits for Ruby, sure.

Rails is a web framework implemented in Ruby, which can be used to develop web apps - as an alternative to PHP.

Upvotes: 3

Related Questions