Archive for the ‘Ruby on rails’ Category

What you think about merger of merb and rails

January 2, 2009 1 comment

I think that development of merb should continue independently as well. what do you think?

First version of rails with threat safety is here

November 22, 2008 1 comment

Rails 2.2 was released yesterday which happens to be first version to support thread safety. Previously lack of threads in rails has been cause of scalabilty concerns especially with twitter problems coming to limelight. So new version of rails will solve these issue? “Not so fast!” says most of people in ruby community.

One of the main reasons why not all new rails application will become multi threaded overnight is native libraries (i.e mysql client library etc). All most all rails applications use these libraries and these libraries block ruby intrpreter from calling these libraries with multiple threads. One answer to this problem is Mysql Plus library which uses never block api.

Another issue with rails multi threading is that it is being added as after thought and has not been extensively tested. if you really has to develop multi threaded ruby web application i think you should go with merb. The merb 1.0 was recently released as well. There are some open source multi threaded applications already out there.

Another issue threads support in Ruby VM. Current Ruby 1.8 VM does not support native threads but next version of Ruby 1.9 VM will support native threads. JRuby VM currently has much more support for threading and it is expected that both Merb and future version of Rails will have great performance and scalibility on JRuby VM. Upcoming Java 7 Runtime will have additional support for hosted dynamic languages like JRuby and Jython which will address many concerns about performance of JVM hosted languages like Groovy, Scala and JRuby.

Categories: Ruby Language, Ruby on rails Tags: , ,

Simplicant Goes into Public Beta

April 21, 2008 1 comment

The public beta of Simplicant was officially released few days ago. As a follow up to my previous post . Here is some details according to official press release.

Simplicant allows SMEs to move towards a more organized, cleaner job applications management system. simplicant is the first web 2.0 applicant tracking system and brings the spirit of web 2.0 into hiring. It is completely web-based (Software as a Service) and makes use of powerful web 2.0 concepts like tags, rankings, search and collaboration to make the hiring experience easier, smoother and quicker.

Here is link to official press release:

Simplicant Goes into Public Beta 

Tags: , ,

BitNami JRubyStack makes JRuby on Rails setup simple

March 18, 2008 Leave a comment

BitNami JRubyStack makes JRuby on Rails setup simple. The stack comes bundled with JRuby, Rails, Tomcat, Glassfish Gem, Mysql and Subversion. You can run your Rails app either with Glassfish or make a war and deloy to tomcat. The whole package is distributed under Apache 2.0 License.

There has been few sites that use JRuby proving that JRuby does scale. Thoughtworks project management application mingle is powered by JRuby and Rails. Sun mediacast site is also now running on JRuby and Rails

Tags: ,

Categories: Ruby on rails

Simplicant Public Beta will be launched soon

September 8, 2007 2 comments

It has been almost an year since my first Ruby on Rails project was launced as private beta. The Simplicant is simplest web based applicant tracking system. Based on years of experience in hiring of medium and small companies, simplicant gives you headstart when you want hire applicants in your comapnies. This Applicant tracking system not only allows you to post jobs on job board and recieve resumes, but also allows you to ask questions before you interview the applicant. After interview simplicant allows you to communicate with applicants

the Simplest applicant tracking system on web 

Simplicant has been totally overhauled  for performance and scalability. The web based interface has features that are found in todays Web 2.0 applications.

The company behind Simplicant is confiz solutions which is known for developing many of todays major Web 2.0 apps. The new public beta for will be launched soon.

STI vs. Polymorphic association

February 17, 2007 1 comment

This is a common to have join between two tables based on condition. suppose we have table in database called comments and we can have comments on different thing like a video, profile or picture. So keeping DRY (Don’t repeat yourself) principle in mind while designing your database. You may want to have relationship between single comments table and videos or profiles table.

At database level you should have two fields in table one field (i.e. type) that identifies the type of comment whether it is a comment on video or it’s a comment on profile, and another field (i.e source_id) that contains id of the video or profile that comment was on.

In Ruby on Rails currently there are two ways to define this kind of association between your activerecord models:

Single Table Inheritance:

Here you ‘ll create a single table of comments and Comment AR class, there would be two additional classes ProfileComment and VideoComment inheriting from same Comment AR class. Instead of having association between Profile and Comment model there would be association between Profile and ProfileComment subclass. Same will be the case with Video model and VideoComment subclass.

If we take a look at comment table we ‘ll see that class name for each record will be automatically stored in type field. The reference to associated table would be in source_id field.

class Comment < ActiveRecord::Base
class VideoComment < Comment
belongs_to :video, :foreign_key => "source_id"
class ProfileComment < Comment
belongs_to :profile, :foreign_key => "source_id"

Polymorphic Association:

Since Rails 1.1 there is a simpler way to create this kind of relationship called polymorphic association. In case of polymorphic association you ‘ll have two fields called commentable_type and commentable_id, instead of type and source_id. The commentable_type field will store name of class which that instance relates to and commentable_id saves the reference to instance of that class. The relations will be created like this:

class Comment < ActiveRecord::Base
belongs_to :commentable, :polymorphic => true
class Video < ActiveRecord::Base
has_many :comments, :as => :commentable
class Profile < ActiveRecord::Base
has_many :comments, :as => :commentable

Pros and Cons:

  • The STI approach offers more flexibilty by allowing you to have additional fields that only have value in case of one sub class. For access from other sub class can be disallowed be overridden accessors.
  • The STI requires you to create a seperate class to implement a relation between two models, resulting in more classses. which is not case with polymorphic association
  • The STI results in more code.It is confusing to some programmers to understand relation between STI classes
  • The polymorphic association is very easy to implement.
Categories: Ruby on rails

Migrate command in Rails 1.2

February 9, 2007 Leave a comment

The usual migrate command syntax of

rake migrate VERSION=x

throws a warning informing the user that the command is deprecated, the new command syntax is

 rake db:migrate 

look at other depreciations in rails 1.2 at