Archive for the 'Steps' Category

Tips for Ruby and Rails programming

1. Be up to date
Try to be a part of the online communities that discuss Ruby and Rails programming so you can be updated on the latest developments in resources, updates, fixes, reviews that you can find online. This robust and constantly moving community is one of the best features of open source technology like Ruby and Rails, so use it and learn new things from it.

2. Utilize plug-ins.
Scratching you head and looking for the right code? Fear not. sites like the Rails Plug-in Directory and Core Rails feature plug-ins that do all the work for you. Many other like-minded sites exist online, it up to you to find them. Such power at your fingertips is one of the many benefits of using open source technology like Ruby and Rails.

Opening, Saving, Closing,Editing and Running programs in Ruby

In Ruby, you have the choice to use any text editor that is more convenient for you. Ruby provides flexibility on whatever Operating System that is used and can run as a ruby program by just simply giving the filename and mentioning of extension is not required. The file extension .rb might still be needed in other programs.

We need to pass the file for processing and execution to ruby interpreter twice. Once to go for the proper syntax errors and upon receiving the success status second time to execute it. We need to give –c and –w as command line switches to get the checking status for errors and warnings if required Here –c states the checking for syntax errors and –w demonstrates the warnings messages to be sent to programmer .If the execution is done successfully we get the actual result displayed on our computer screens.

First Steps through Ruby on Rails


Image Source:www.flickr.com

Classes, attributes, methods, and objects are the core of any Object-Oriented language. I am going to discuss how these classes, attributes, methods etc can be implemented in Ruby. There are two types of classes ‘close-ended’ and ‘open-ended’. If a class is close-ended, then new functionalities cannot be added to it without inheriting the class.
If a class is open-ended, then new functionalities can be added to it without inheriting it. Ruby is open-ended.
The class declared and defined just now is an empty class as it doesn’t contain any attributes or methods. You will notice that the procedure to define methods in ruby is very simple. def is the keyword used to define methods.
In ruby we don`t use brackets to define a set of code and we don`t use any semicolon at the end of the statements.

Copyright ©Basic Ruby On Rails Programming.