Ruby on Rails Programming Tips

On the High Rails with Ruby

Ruby on Rails (ROR) is the recent addition to the Internets DIY (Do it Yourself) Magic Kit. It is an open source web application development framework based on the Ruby Programming Language. Like its parent, it is highly user friendly, much simpler to learn & apply & has time proven outputs to justify its unearthed position in the market. If you have dreamt of putting up your website online with all that interactive thingies, now is the chance.

Buy your own domain & your web space. You can find a lot of cheap web hosting services online, after a small research of course. Find out the services they offer you, the bandwidth, the email accounts, the security features & so on. With a good & cheap web hosting services and Ruby on Rails to assist you, you can set up a cyber wonder in no time.

Though Ruby on Rails embodies a lot of libraries (like Prototype and others) developed in Javascript for Ajax, it is much simpler than Java itself. If you assume learning all the tricks & codes of core Java in a period of two months, Ruby on Rails will give you the same power in a couple of weeks, thanks to its easy to use “snippets”. Plus, the output can be derived in the globally acclaimed HTML & XML formats. The latest release (3.0.7) carries forward the “Convention over Configuration (CoC)” Legacy of the Rails Core Team. Thanks to the third party developers, many plug-ins have been devised for various platforms.

About Ruby on Rails

An open source web application framework written in Ruby is commonly known as RoR (Ruby on Rails). It was designed to make web development faster, simpler and more efficient and it also used to develop real-world application with less code, compared to other application frameworks. Ruby on Rails divides itself into various packages, namely Active Record, Active Resource, Action Pack, Active Support and Action Mailer.

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.

September-Ruby on rails programming roundup

The news just kept showing every day, what a great Ruby on Rails for September. Since it was launched it was being supported and its just getting bigger and bigger. There are many list of programmers who featured Ruby on Rail (ROR), there are new blogs studies and resource tutorials or software.

RoR and Text Editors Part-2

More on text editors that are used with RoR and we not discuss VIM or Vi Improved. Vim like Emacs is quite efficient and easy to use with RoR provided it is set-up properly. The nice about Vim is that it has the nifty way of highlighting syntax in ruby making it easy to trace and debug. It features advanced features such as having a selective command and insert mode with the first being the default mode upon startup. It is not a word processor so fonts and other word processor features are not to be expected.

TextPad
One of the quickest and easiest to use as a text editor for making RoR programs with straightforward interface and features mostly adept to windows users. Though considered a text editor it is capable of syntax highlighting, search , spell check and macro recording which makes it a choice of many developers.

ArachnoRuby
Is deployable on both windows based and Unix based systems and is considered to be the native editor of RoR. It was not too user friendly so it quickly lost favor of many developers who turned to the other specified editors for programming code.

Database manipulation

The database has been initialized, so now we get down to business of defining the fields in that database and include a field that we would call a foreign key which allows the establishment of the one to many relationship between the tables. This part of the process requires quite a bit of background of database creation, manipulation and handling. It also requires knowledge regarding the workings of data types. So assuming you do not have much knowledge in such areas do some more reading to give you a better understanding of what how and why they are there. The ROR developers might say that it is very easy to do and use ROR but without the background on logic formulation, data types and manipulation as well as database handling the rest of the posts which would tackle ever hardening topics and operations would be very difficult to make sense of.

Don’t get me wrong, we just want to make life easier for you and not have you not understanding anything at all.

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.

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.

Upgrading Rails

mac_rails_on_windows.png

One tip to upgrade your Rails is by running Gem to get the latest release. You can do this using:

gem update rails -y
or
sudo gem update rails -y

If you are planning to upgrade your existing projects in Rails, you can try the following method:

• Open your_project/config/environment.rb and change RAILS_GEM_VERSION to determine the version you just upgraded to.
• Run rake rails:update from your project’s root directory (this will copy in new versions of javascript libraries, etc.).
• Check to make sure that any tests you may have written still pass.

Also remember to use gem cleanup to remove older versions of rails.

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.