Ruby on Rails Programming Tips

How to Install RubyGems and Rails on a Shared Web Host

by Chubs

webweb.jpg

RubyGems or Gem allows you to install extra packages and libraries for Ruby. You need Gem before installing Rails. You can get the latest version of RubyGems here.

cd /temp
wget http://rubyforge.org/frs/download.php/3700/rubygems-0.8.10.tgz
tar -zxvf rubygems-0.8.10.tgz
cd rubygems-0.8.10

To install RubyGems, you need to use Ruby to call the setup script:

ruby setup.rb

Here, you should see “Successfully built RubyGem” if it’s finished. Next, open the file “/usr/local/ruby/bin/gem” in your favorite text editor (such as vi) and edit the first line so you’ll know where to find your custom Ruby installation. Example:

#!/usr/local/bin/ruby

Now, add a few more symlinks:

cd /usr/local/bin
ln -s /usr/local/ruby/bin/erb erb
ln -s /usr/local/ruby/bin/eruby eruby
ln -s /usr/local/ruby/bin/gem gem
ln -s /usr/local/ruby/bin/gem_server gem_server
ln -s /usr/local/ruby/bin/testrb testrb
ln -s /usr/local/ruby/bin/update_rubygems update_rubygems

RubyGems is now installed. To install Rails, use:

gem install rails –remote

Ensuring Ruby App Security

Experts agree on the importance of each and every app deployed using Ruby, one of the most powerful but least used platforms for building apps on the internet. Twitter is one of the best examples of the hidden talents of Ruby on which it is built upon.
On any app, there is usually a login process to which controls should be attached for logged in doesn’t mean goodie user. User authentication should be very much defined to authorization to do anything in an app so try to make this area robust with login expiry, and limiting access to changeable areas of the app.

An iPad or a Kindle Fire?

This may be an easy comparison for some with the automatic answer being “iPad, of course!” If you examine your needs well, you may find that you can live well with a Kindle Fire.


Photo Credit

Yes, the iPad is the leader in touch screen technology. Apple’s touch screen grasp is arguably the best in the market. The Apple applications again are arguably the best. There is even a Kindle for iPad application.
The main drawback to this comparison is that the iPad is very expensive, Especially the latest version. If you are someone on a budget, or if you have kids and want a gadget that they can use as well but you have to stick to a strict budget, the iPad may not be an affordable option.

The Kindle Fire boasts of a colored touch screen that can play videos, games, show books and illustrated books. It is also supposed to be easy to use and kid friendly. The Kindle fire is also at least half the price of an iPad.

If you are someone who wants a tablet from a good manufacturer but does not have a big budget or does not want to spend too much, then the Kindle may be a good choice.

Top 10 Ruby on Rails performance tips

There are 10 Tips Ruby on Rails performance, they are; 1. Optimize your Ruby Code, 2. Use your database to the full extent of law, 3. Caching is good, 4. Finders are great but be careful, 5.Group operation in a transaction, 6. Control you controllers, 7. Use HTML for review, 8. Logging, 9. Patch the GC, 10. A Final Note.

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!

Ruby on Rails Chases Simplicity in Programming

Ruby on Rails has focused on creating templates and designs that tackle the unglamorous problems. It is not also to create a sophisticated development framework that the engineers at Google or Amazon.com will flock to; it is like making a database modification that the great majority of Web developers face every day.

RoR Application Directories in-depth

There are quite a number of directories locate in the apps folder we have just created so to de-mystify them here are some explanations which hopefully would help you out. The directory “app/controllers” is where Rails searches for the controller classes which controls the web request from the user. The next one is the, “app/views” folder which houses the templates to which the data from the app is converted to HTML and then returned to the user’s browser. The next folder houses the “apps/models” subdirectory which contains the data classes that wraps the data stored within the application’s database (this is the messiest part of the framework in other frameworks). Then last of the vital sub-directories is the “app/helpers” which hold the helper classes of data that assists the view, model and controller classes keeping them small, organized and focused on the task it is supposed to do in the first place.

Using the ‘yield’ statement

It might be almost similar but relatively different in a big way for blocks may appear only in the source adjacent to a method call which means it should be written on the same line as the method’s last parameter and it is not implemented once it is encountered but, Ruby rather remembers the context by which the block of code appears then enters the method. Within the method itself, the block of code may be called as if it were a block in itself by using the ‘yield’ statement. After the block of code has been executed, control returns immediately right after the call to the yield statement. Sample use of ‘yield’:

def threeTimes
yield
yield
yield
end
threeTimes {puts “Hi There”}

The Rails Wiki

ruby-rails_project_night_audience_preview.jpg

The key to a successful online web development community is accurate and accessible documentation for everyone. That is why the Rails community came up with its own Rails wiki so that users can contribute information and other helpful tips to fellow Rails users. The Rails wiki has everything from the how-to’s in getting started with Rails (installation guides, tutorials, books and FAQ, troubleshooting, tip sheet for beginners, etc.) to community announcements (trainings and job postings, development firms, etc.). One can also find in the Rails wiki the lists of online help groups for Rails users (forums, IRC, user groups, ProblemBase, etc.)

The Gadget Question

There can be no denying that gadgets today can do so much for a person. Truth be told, a person can do almost anything on the gadgets these days. It has been said that a person can read, go on all kids of social media, do groceries, shop, conduct bank transactions, and basically operate the lighting in the house from a gadget. So one important question is, does a person need one of each kind of gadget, or is one enough?

small__6754500383
credit

The answer is simpler that it looks. It really depends on use. If you are the kind of person who does all of the above plus more on your gadget, then perhaps a tablet is the best choice for you. It can be your ebook reader, your music player, your social media hub, your business center, and your banking support all in one. But, if you are a simpler person who uses his or her gadget just for reading, music, calls, and the occasional surfing, a smart phone might be a more afforable choice.