SCSI Hard Drives
Search
Advanced Search

Categories


Recently Viewed
.

Clear List
Pages



My Links
Web Directory Index
A human edited, comprehensive web directory list.
Link Exchange
DesignFirms Link Exchange


Creating pages in Ruby

By : yankees26an
Rating : Average Rating : 6.00 From 3 Voter(s)


If you haven't noticed, Ruby on Rails makes your job(the developer) easier by using something most programming languages don't have: common sense. :D By that, I don't mean you can type in words and expect ruby to magically sort everything out for you, but it's not far from that! Ruby does alot of background work using 'sensible defaults' that are set up, and if you go with the flow, it will save you alot of code. Here's an example: First let's create something to work with. Let's create an applicatoin called atmt. First go into your ruby console and type this(if your using windows): rails atm Then let's create our controller : ruby script/ generate controller (choose whatever name you want) wow Now lets create some pages! Open up your wow controller and add the following code
def login

end

def logout

end

def my_balance

end

def home

end

def my_mail

end
Now that we initialized the pages in our controller, we now have to create the pages. Just think of it as declaring variables. First you have to create it, then you can fill it in. That's what's happening here - we're telling the controller there WILL be a page called login, logout, etc. Now you'll see ruby's first 'sensible defaults.' When you define a page in the controller, the pages you create must match the names in the controller to work. If we agree to this, it will save us alot of work, and ruby will automate most of the process for it.







Comments / Feedback

RSS 2.0: Syndicate this article

Add Comment
* Name


* Email Address


Site



*Image Validation (?)


*Comments / Feedback





Print Article Print Article Send to a friend Send to a friend Save as PDF Save as PDF Social Bookmarking
Add to: Mr. Wong Add to: Webnews Add to: Icio Add to: Oneview Add to: Folkd Add to: Yigg Add to: Linkarena Add to: Digg Add to: Del.icio.us Add to: Reddit Add to: Simpy Add to: StumbleUpon Add to: Slashdot Add to: Netscape Add to: Furl Add to: Yahoo Add to: Spurl Add to: Google Add to: Blinklist Add to: Blogmarks Add to: Diigo Add to: Technorati Add to: Newsvine Add to: Blinkbits Add to: Ma.Gnolia Add to: Smarking Add to: Netvouz Information
Rate this Article :

1

2

3

4

5

6

7

8

9

10
Poor Excellent