Ruby - Still on the Sidelines?
Ruby has long been fighting for recognition in the world of open-source development and in the past few years, it surely has managed to go mainstream with some major development projects. One surprising fact when it comes to overall popularity, recent development surveys show that use of the scripting language has jumped by 40% which may be sign that people are embracing more options in their drive to lower all costs with regard to the newer versions of the many flavors being used all over the globe. The updated Ruby on Rails 2.3 is a bit better and easier to use compared to previous to older versions and with the recession putting the brakes on many projects being planned, alternate methods of development and deployment have to be found to allow enterprise to continue with their plans with less costs. Keep on reading!
Rails 2 - Enterprise Ready
From the recently concluded RailsConf 2009, the many core Rails developers have made it known that Ruby on Rails 2.0 is indeed enterprise ready for use on the net. As with many of the open-sourced languages being used the world over, security remains to be one of the greatest concerns due to the open nature that is counter-intuitive for most enterprise development projects who need their information secured in more ways than one. Another good point given light was the ability of the current version to scale meaning adapt with changing conditions that allows easy upgrades allowing more people to use without much fuss. Keep on reading!
Mac’s and Ruby - Nice!
The somewhat hidden world of the Mac from Apple has remained in place as one of the alternate PC manufacturers the world over. Many have been forecasting the demise of the computer maker but with their venture into other avenues such as the multimedia gadget market and others have allowed them to remain a figure in the computing industry. Thous everybody knows that Mac’s are overall more stable than PC’s there are still not enough versions of popular software available for Macs compared to other computing platforms. Keep on reading!
JRuby
The match can be called one made in heaven, that is to stress the point of a scripting language that has added benefits and power with the injection of code from languages such as ruby. JRuby as it is called has the ruby engine embedded within Java apps allowing both to do what they do best. Having one of the most powerful scripting languages to use the extensive open-source native libraries or the ones included when combined with other languages makes for one strong and powerful mix. Keep on reading!
Some handy ideas for using Rails

1. Never underestimate the power of plug-ins.
It’s really going to be a waste of time developing script that somebody has already beaten you to. So instead of making your own, why not look for applications and plug-ins that do all the work for you? That’s the beauty of open source. Try looking at sites like Rails Plug-in Directory and Core Rails to help you find the particular plug-in you’re looking for.
2. Keep yourself updated.
Another beauty of open source is that there are a lot of resources, updates, fixes, reviews and all other sorts of opinions out there about Ruby and Rails and everything in-between. So try to integrate yourself into online communities that discuss Ruby and Rails programming so you can keep abreast with all the developments in the community. Trust us, you will always learn new things.
MemoPal’s Cloud Search
The release of MemoPal of their much awaited Cloud Search, is a very powerful tool that would simplify and speeds up online file searching. It makes remote file searching faster with the advent of cloud computing everything becomes well, a little cloudy for most who are still coming to grips with the technology and it’s benefits. Keep on reading!
Ruby and Merb: Peace at last

Ruby on Rails and Merb has been at war for a long time, and if there was ever a time that peace should reign, it should be on the holidays. And here they are combining to form, Rails 3:
We all realized that working together for a common good would be much more productive than duplicating things on each side of the fence. Merb and Rails already share so much in terms of design and sensibility that joining forces seemed like the obvious way to go. All we needed was to sit down for a chat and hash it out, so we did just that.
What this will mean in practice is that the Merb team is putting their efforts into bringing all of the key Merb ideas into Rails 3. Yehuda Katz will outright join the Rails core team, Matt Aimonetti will work on a new evangelism team, and Carl Lerche and Daniel Neighman (hassox) will be co-starring the effort to bring all this over. We’ve immortalized the merge with plaque page at rubyonrails.org/merb.
Always give peace a chance, I say.
Hashes : In Layman’s Term
Image Source: codeproject.com
One key feature of Ruby on Rails is Hashes. Now, just try to think of hashes like a PARTY. The party is a potluck occasion, naturally, each guest is required to bring an item or food. You will then need a LIST of all the guests, now this can be managed as an array. But you will also have to make a way to monitor all types of food that is being brought to the event. And to explain it further, you will want to know who is bringing the pasta, who will be bringing the fried chicken and so on. This is where Hashes come in. You will use hash to store value pairs or key pairs, this in turn will enable you to store that particular data. If for example Amanda is the “key”, and she brought cake, the variable stored and accessed by the key will be “cake”.
Creating a Model on Rails

Image Source: intertwingly.net
This is not based on a database application, so we can pretty much keep the name, which is comfortable for us. Lets take for example if we have to make a DataFile model.
C:\ruby> ruby script/generate model DataFile
- exists app/models/
- exists test/unit/
- exists test/fixtures/
- create app/models/data_file.rb
- create test/unit/data_file_test.rb
- create test/fixtures/data_files.yml
- create db/migrate
- create db/migrate/001_create_data_files.rb
Now we will create a method called save in data_file.rb model file. This method will be called by the application controller.
- class DataFile < ActiveRecord::Base
- def self.save(upload)
- name = upload['datafile'].original_filename
- directory = “public/data”
- # create the file path
- path = File.join(directory, name)
- # write the file
- File.open(path, “wb”) { |f| f.write(upload['datafile'].read) }
end
Ruby Symbols: Explained

Image Source: knowtebook.com
Many programmers old and new to ruby alike, get confused when they see Ruby symbols, sometimes or all the time. It will take a lot of getting used to, before you ever do this smoothly. A lot of us came to know about the Ruby language through Ruby on Rails projects. In Ruby on Rails, symbols are everywhere. I mean everywhere. So it is important to note and memorize the concept of symbols in Ruby.
A symbol in Ruby is an instance of the class Symbol. A symbol is defined by prefixing a colon with an identifier like “:name”, “:id” or “:user”. The Symbol class in Ruby contains one class method:
- all_symbols and instance methods id2name, inspect, to_i, to_int, to_s and to_sym.
- all_symbols - returns an array of all the symbols in Ruby’s symbol table.
- id2name - returns the string representation of the symbol,:name.id2name returns “name”.
- inspect - returns the symbol literally
- to_i - returns an integer unique for each symbol
- to_int - same as to_i
- to_s - same as id2name
- to_sym - converts the symbol to a symbol.