Archive for the 'Features' Category

Features of Ruby Programming

Ruby Programming is an object-oriented program. It has four levels of variable scope which are: global, class, instance, and local. It has exemption handling. There are iterators and closures that are based on passing blocks of code. Ruby is also a native, Perl-like regular expressions at language level. The program features an automatic garbage collecting, operator overloading and is highly portable. It is has cooperative multi-threading on all platforms using green threads. It has a large standard library and DLL/shared library dynamic loading on most platforms. Ruby supports dependency injection and object runtime alteration. Ruby currently lacks full support for Unicode, though it has partial support for UTF-8.

Rails 2.3 Finally!!

railscreenshotThe much awaited upgrade to the much loved yet seemingly less loved Roby gets a full update with the full release of Rails 2.3 loaded with many updates and improvements to the rising underdog of the open-sourced world. Top features includes more built-in templates, making implementation of stripped down rails applications onto a skeleton framework easier, loaded with your default gem stacks, configuration settings and much much more. Nested forms have also become easier with improved built in handling allowing complex forms to be included easy as pie. Reusable application pieces in the engine completes the whole picture which allows developers and programmers to use, reuse and recycle working modules, easily including them into their current projects. Continue Reading »

Email on Rails

Image Source: joeydevilla.com

This is a guide on how to send message from your email using Ruby on Rails. First thing to do is to create a mailer for you to use in your application.

  • Open the command prompt window or your terminal
  • Run “./script/generate mailer MyMailer” from your Rails application home directory

Then you will have to configure the mailer. To be able to do this you should;

In your text editor, open config/environment.rb
Then add this script in the file’s bottom part

config.action_mailer.delivery_method = :smtp
ActionMailer::Base.server_settings = {
:address => “smtp.example.com”,
:port => 25,
:user_name => “username”,
:password => “password”,
:authentication => :plain
}

Rake like Make

Image Source: blogs.sun.com

Rake is a utility which is the same with Make in Unix. Rake is the Make of ruby or the Ruby Make. Luckily, Rails defines many tasks to help you. Some of the important commands which are supported by Ruby’s rake is

listed below;

  • rake db:fixtures:load - Load fixtures into the current environment’s database.
  • rake db:migrate - Migrate the database through scripts in db/migrate.
  • rake db:schema:dump - Create a db/schema.rb file that can be used against any DB.
  • rake db:schema:load - Load a schema.rb file into the database.
  • rake db:sessions:clear - Clear the sessions table.
  • rake db:sessions:create - Creates a sessions table for use with
    “CGI::Session::ActiveRecordStore”.
  • rake db:structure:dump - Dump the database structure to an SQL file.
  • rake db:test:clone - Recreate the test database from the current environment’s database.
  • rake db:test:clone_structure - Recreate the test databases from the development structure.
  • rake db:test:prepare - Prepare the test database and load the schema.
  • rake db:test:purge - Empty the test database.
  • rake doc:app -Build the app HTML Files.
  • rake doc:clobber_app - Remove rdoc products.
  • rake doc:clobber_plugins - Remove plugin documentation.
  • rake doc:clobber_rails - Remove rdoc products.
  • rake doc:plugins - Generate documation for all installed plugins.

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.

Why should you learn the Ruby Language?

Beginners nowadays usually starts with Java, C++ or C#. We must keep in mind that every programming language has its own strengths and weaknesses. The Ruby Language is still unknown to some students (and even programmers) but I believe that we should study this wonderful language because of the following reasons

The Ruby Language is one of the easiest to work with among languages I have encountered so far. According to some of Ruby devotees, it is a flexible language. You can easily extend class definitions and redefine anything and you can freely add built-in classes.

In a way, Ruby makes a programmer creative. Plumbing code is less required and you can concentrate on the problem itself. Blocks can help you out make the code efficient.

Ruby might still be considered as a “newbie” in the programming language world, but it’s getting a lot of attention lately due to the testimonials of its users. A Ruby Language can help you built web applications in an instant!