Re: ActiveRecord bottom half

Perry Smith
2007-07-07T17:21:38Z

Bill Walton wrote:
> Hi Perry,
>
> Perry Smith wrote:
>
>> What I want to do is create a table that has a unique id
>> and a string which will be the type.  The other tables that
[ snip ]
> hth,
> bill

The big thing that is frustrating me with the existing methods is how to
do validation.  As I said, I can not get validates_presence_of to work
for me in a polymorphic belongs_to.  I''m torn between trying to do
validation up in Rails or down in the DB.  As I said, this may be all
folly but I''ve implemented the application (the basic functions) using
the standard Rails concepts.  But, I can not figure out how to make sure
the thing the belongs to association really does exist and I can not
figure out a way to prevent it from being deleted before everything that
points to it is deleted first.  Those two things is what led me down
this journey.

What I am trying to do is just subtly different for sure but the
rearrangement of the tables and keys will make the DB validation part
much easier.  It also reduces the amount of redundant information.

The only thing that PostgreSQL gives me is rules and stored procedures
to do the validation in the DB.  I''m not sure but I think those are not
in other DB''s.

To recap, I''m not wanting to go down this path.  I just want to
validate
the database and keep it valid at all times.