Tag: rails

When convention over configuration sucks

Posted by – February 2, 2009

Last saturday I wrote a small application using rails 2.2.2, rails is pretty handy in many ways, when writing models, controllers and views, I could get this application working almost like its jsf version, except for one thing, convention on primary keys.

Rails has a convention on primary keys, if you are using sqlite as database you are limited to use an auto-increment column as primary key, no user provided id is allowed. You can customize the column name of primary key, but nothing more.

To change the column name of your primary key you must call set_primary_key method on your model class, like below:

class Supplier < ActiveRecord::Base
   set_table_name "supplier"
   set_primary_key "fid"

No way to deploy Rails applications on Apache running under Windows

Posted by – January 20, 2009

After few days trying to run a rails application under apache with “help” of fastcgi module and without any success I’m finally giving up this idea, the reason is simple, I just can’t compile a c code used by fastcgi binding for ruby because of some missing header files and compiler support.

I tried to get the same application running on apache without fastcgi module but it is too sloooow.

The truth is, you can develop rails applications on windows, but please, don’t try to run this applications on apache with fastcgi support, you will waste you time.

To be honest, I don’t have the same problem when running Rails applications on top of JRuby since I can deploy these applications on any servlet container like Tomcat or Jetty.


ActiveRecord Rocks But I Can’t Say the Same About Rails Views

Posted by – September 15, 2008

ActiveRecord has proven to be a easy to learn and productive ORM solution, you can define your application model with few lines of code, the syntax is much more concise than any other ORM solution.

But, in other hand, rails doesn’t have a elegant way to work with views, with a lot of loops and conditional expressions in the middle of code, this kind of approach remembers me the PHP coding 8 years ago, where after several lines your code become very hard to understand an maintain.