I think the primary benefit would be that views would be included in
schema.rb and thus would be usable in the test environment with no
additional work required. The primary thing is that Rails would
understand views whereas right now views just get silently ignored.
V/r
Anthony
On 1/12/07, James Adam <[EMAIL PROTECTED]> wrote:
>
> I think possibly the biggest issue with bringing views into AR's
> schema notation is that most (useful) views don't just contain columns
> from other tables; they often perform functions (SUM, AVG). From
> looking at the current plugin, it seems like you'd end up having to
> write that as a fairly explicit SQL statement, and I'm not sure in
> such cases how great the value in using Ruby to declare the columns.
>
> In a nutshell, is
>
> create_view :v_stuff, %{
> SELECT thing_id, other_thing_id, SUM(stuff) as blah
> FROM things, other things
> WHERE thing_attribute LIKE "wibble"
> GROUP BY other_things.cost
> } do |v|
> v.column :thing_id
> v.column :other_thing_id
> v.column :blah
> end
>
> really that much better than
>
> SomeModel.connection.execute %{
> CREATE VIEW v_stuff AS (
> SELECT thing_id, other_thing_id, SUM(stuff) as blah
> FROM things, other things
> WHERE thing_attribute LIKE "wibble"
> GROUP BY other_things.cost )
> }
>
> ... I'm not sure. Convince me, because we're using views with
> legacy-style databases at the moment, and if anything can be done make
> this simpler, I'm definitely interested.
>
> - James
> On 1/12/07, Anthony Eden <[EMAIL PROTECTED]> wrote:
> >
> > One of the items which has come out of the ActiveWarehouse plugin
> > development is the Rails SQL Views plugin. It adds support for
> > create_view and drop_view statements in migrations and also supports
> > extracting those elements to the schema.rb dump. Currently it is
> > implemented for MySQL and PostgreSQL. Is there any interest in
> > eventually moving this code into ActiveRecord or should it just remain
> > as an extension gem/plugin?
> >
> > If there is interest to bring it into the AR core then I can create
> > the patches for it.
> >
> > Thoughts?
> >
> > V/r
> > Anthony Eden
> >
> > --
> > Cell: 808 782-5046
> > Current Location: Melbourne, FL
> >
> > >
> >
>
>
> --
> * J *
> ~
>
> >
>
--
Cell: 808 782-5046
Current Location: Melbourne, FL
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" 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-core?hl=en
-~----------~----~----~----~------~----~------~--~---