I'm considering porting an application to RoR. The application is
basically a "Order Entry" type system for the Interior Designer
vertical market. The existing application has a table with over 400
column! (not my design!). The majority of these columns are
measurements and descriptions for a certain types of product
categories (e.g., "Draperies","Sheer Draperies",
"Upholstery","Pillows","Lampshades", etc)

Each one of these categories (25+) has a custom form that display the
measurement attributes for that category. To make things worse,
there's a lot of javascript that enables/disables/shows/hides areas/
fields. There is some sharing of attributes (width, height, length,
size, for example). I can cut down the javascript by creating more
categories - for instance there are 3 types of "Sheer Draperies".

I alway though that these "Category Details" didn't need to be stored
individually in a record, but serialized in a "Details" fields. Now
the basic question is what would be the best approach?

I've never done xml/xslt type forms and don't know how difficult that
would be.

I've experimented with what could be considered "Tableless STI" and it
works, but with a few gotcha's. For instance:

class Detail < ActiveRecord::Base
  def self.columns
    @columns ||= [];
  end
 ... rest of tableless stuff
  #common attributes
  column :type, :string
  column :category, :string
  column :workroom_material_reference, :text
  column :description, :string
  ....
end


class Carpet < Detail
  column :style, :string
  column :quanity, :integer
  column :yards, :float
end

The tableless approach would not allow me to create a new Carpet
without first doing Detail.new. There were other problems that I
hacked around, like defining  def self.new_category(category) that
creates new ActiveRecord objects for both the basic attributes and the
category attributes. Maybe if I used a real table, some of those
problems would go away.

That approach is livable, but was wondering if I am totally missing a
better approach?

Anyway, I know I am still going to have a couple hundred date elements
to deal with and a bunch of partials.

Anyone want to point me in a different direction?

Steve Alex



-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to