Been in another deep dive on Rails and JRuby. This is a remarkably robust framework for web development as long as you follow the conventions. I am pretty well convinced that if you are developing a new application from scratch, and have the luxury of creating a new DB from scratch, Rails will get you to an end result quicker than any other framework out there. That said, I have not seen the same productivity when working with legacy databases and Rails. In fact, the particular schema that I work with and that has been on the midrange platform since S/34 days, has not played well with Rails at all.
First issue: Rails looks to pluralize names of tables. If you create a model (DB Access logic) called Customer, it assumes a table called customers. This one is easily resolved in rails because you can set ActiveRecord::Base.pluralize_table_names = false in your environment.rb file. Also, a "customer" model may need to point to a more cryptic DB2/400 table called PPUR301 (or some such thing). There is a fix for this as well: Add the following to your model: def self.table_name() "mytablename" end
Second issue: Rails assumes a few things about your primary keys for tables:
1. That the primary key for ALL tables follows a specific naming convention. That is, ALL the primary keys are called 'id' or 'keyid' or something that applies across all tables. There is a fix for this as well. You can set the primary key value in each model to point to the actual primary key name. e.g. use set_primary_key "mykey" in your model.
2. That all your primary key values are numeric and are auto-incrementing values. That can cause quite a bit of heartburn for a table that uses alpha numeric values in all of its primary keys. Since the whole concept of an auto-incrementing column value is relatively new to DB2 for i5/OS, most of us don't have primary keys that follow the convention (especially if we have a schema that orginated on the S/34). The Rails "fix" is to add a field called ID to your tables but for those of us using RPG and native I/O, we know that the fix isn't an option since we may have RPG programs that would have to be recompiled if we added a new column to the table. I am still working toward a fix for legacy tables for this issue. If you have a suggestion, let me know.
Third issue: Column names in the schema. Rails allows pretty much anything in a column name that is a number, letter or underscore but if you have something esoteric, like I do, where column names have embedded '#'s then Rails is very, very unhappy. # has a special connotation in Ruby so I haven't come up with a fix for this either.
My goal is to get a simple CRUD application to successfully accesses a set of legacy tables. Preferably a "header/line" set of tables so that I can mimic the use of what would normally be a subfile application.
So what about EGL? That is next on the horizon. I am leaning heavily to Rails for my new "ground up" development but I don't think I am going to be able to hook up a Rails application to my legacy databases with the same level of productivity. I am hoping that EGL will fill that need.
Looking forward to the experience and I'll document it here when I do.