One form for different models


#1

Currently I have a form with some inputs, related to a wiki page. So I
have:
<%= text_field ‘page’, ‘title’ …
<%= text_field ‘page’, ‘summary’ …
<%= text_field ‘page’, ‘body’ …

And a model called “Page”, extending from “ActiveRecord::Base”, and
storing data in MySQL.

But know I have to record the attributes in some other part, having just
the “body” att. stored in MySQL, and the other attributes, let’s say, in
a file.

So, what should I do? I first thought of keeping my “Page <
ActiveRecord::Base”, and storing there just the “body” attribute (and
the table in MySQL just storing this attribute, deleting the other
columns), and create another model called “Whatever”, which stores the
other attributes (but not extending from “ActiveRecord::Base”). That way
my view would have:
<%= text_field ‘whatever’, ‘title’ …
<%= text_field ‘whatever’, ‘summary’ …
<%= text_field ‘page’, ‘body’ …

But, if I did this… how can in my “Whatever” model would validate the
things I used to validate with a model extending from
“ActiveRecord::Base”, such as:
validates_uniqueness_of :title…
validates_length_of :title, …

Thanks.


#2

looking through google I’ve found this[1], so I will try if it works:

[1] http://www.railsweenie.com/forums/2/topics/724