Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
Look up keyword or section
Like this

Table Of Contents

0 of .
Results for:
No results containing your search query
P. 1
ROR ref by Ajaykumar

ROR ref by Ajaykumar

Ratings: (0)|Views: 79|Likes:
Published by Arun Kumar

More info:

Published by: Arun Kumar on Sep 09, 2008
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





What is
Before we ride on Rails, let's know a little bit about Ruby which is the base of Rails.Ruby is the successful combination of:
Smalltalk's conceptual elegance,
Python's ease of use and learning, and
Perl's pragmatismRuby is
A High Level Programming Language
Interpreted like Perl, Python, Tcl/TK.
Object-Oriented Like Smalltalk, Eiffel, Ada, Java.
Originated in Japan and Rapidly Gaining Mindshare in US and Europe.
Ruby is becoming popular exponentially in Japan and now in US and Europe as well.Following are greatest factors:
Easy to learn
Open source (very liberal license)
Rich libraries
Very easy to extend
Truly Object-Oriented
Less Coding with fewer bugs
Helpful community
Why Not
Performance - Although it rivals Perl and Python.
Threading model does not use native threads.
Sample Ruby Code:
Here is a sample Ruby code to print "Hello Ruby"
# The Hello Classclass Hellodef initialize( name )@name = name.capitalizeend
def saluteputs "Hello #{@name}!"endend# Create a new objecth = Hello.new("Ruby")# Output "Hello Ruby!"h.salute
Embedded Ruby:
Ruby provides you with a program called ERb (Embedded Ruby), written by
. ERb allows you to put Ruby code inside an HTML file. ERb reads along,word for word, and then at a certain point when it sees the Ruby code embedded in thedocument it sees that it has to fill in a blank, which it does by executing the Ruby code.You need to know only two things to prepare an ERb document:
If you want some Ruby code executed, enclose it between
If you want the result of the code execution to be printed out, as part of the output,enclose the code between
.Here's an example, Save the code in erbdemo.rb file. Please note that a ruby file will haveextension
<% page_title = "Demonstration of ERb" %><% salutation = "Dear programmer," %><html><head><title><%= page_title %></title></head><body><p><%= salutation %></p><p>This is an example of how ERb fills out a template.</p></body></html>
 Now, run the program using the command-line utility erb
c:\ruby\>erb erbdemo.rb
This will produce following result:
<html><head><title>Demonstration of ERb</title></head>
<body><p>Dear programmer,</p><p>This is an example of how ERb fills out a template.</p></body></html>
What is Rails
An extremely productive web-application framework.
Written in Ruby by David Heinemeier Hansson.
You could develop a web application at least ten times faster with Rails than youcould with a typical Java framework.
An open source Ruby framework for developing database-backed webapplications.
Your code and database schema are the configuration!
 No compilation phase required.
Full Stack Framework 
Includes everything needed to create a database-driven web application using theModel-View-Controller pattern.
Being a full-stack framework means that all layers are built to work seamlesslytogether Less Code.
Requires fewer total lines of code than other frameworks spend setting up their XML configuration files.
Convention over Configuration
Rails shuns configuration files in favor of conventions, reflection and dynamicrun-time extensions. Your application code and your running database alreadycontain everything that Rails needs to know!
Rails Strengths:
Rails is packed with features that make you more productive, with many of the followingfeatures building on one other.
Metaprogramming :
Other frameworks use extensive code generation from scratch.Metaprogramming techniques use programs to write programs. Ruby is one of the bestlanguages for metaprogramming, and Rails uses this capability well. Rails also uses codegeneration but relies much more on metaprogramming for the heavy lifting.

Activity (5)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
vijayang liked this
vijayang liked this
Mukul Arora liked this

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->