On 4 Jul., 00:10, Matt Jones <[email protected]> wrote:
> Even the view method is going to end up binding the two together,

Of course, but it will derive the 'type' at the moment of the query,
and not a type that was last UPDATEd by the last RoR application (and
hopefully anybody else accessing the DB).

> Maybe I'm being dense, but it doesn't seem like any more "code in the
> DB" than defining the view.

Unfortunately it _is_ a lot more.
A database view is per se not updateable - several mechanism are being
discussed for a solution - like here for Postgres:
http://wiki.postgresql.org/wiki/Updatable_views

None of these concepts is simple and without debate.
And IMHO updateable view is also violating the "spirit of the
inventor" of relational DBs.

> Or, as the computer scientists call it, "memoization". I'd presume
> that the types involved change far less often than the data is
> accessed.

The database and its developers are mostly more succesful in deciding
how to optimize access to its tables than an application. This is one
of the organizational decisions a database implies.

> Some Google searching shows that most of the discussion around views
> and ActiveRecord focuses on either using updatable views or on doing
> read-only stuff with non-updatable views. I did find the Class-table
> Inheritance plugin, which may yield some insight for your project
> (docs @http://clti.rubyforge.org/).

Ok, I'll look closer into this.

> The biggest issue is that while
> views are part of the SQL standard, the rules for updating are very DB-
> specific. Since AR is targeted to be database-independent, the result
> is totally ignoring the feature.

Exactly - that's why it would make sense to have a standard RoR method
for setting a DB function - see example in my first post - for
deriving the class; instead of a fixed column.

And concerning DB-views, which is a separate issue:
A standard RoR solution for DB-Views would be nice.


--~--~---------~--~----~------------~-------~--~----~
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