On Jun 21, 6:09 am, GregD <[email protected]> wrote: > All, > > Is there a way to create a Model that uses the views query instead of > a table? I guess what I'm asking is can a DB view be wrapped into a > Model class? The database I'm working with has a few views that would > be nice to use instead of duplicating the queries in a dataset > row_proc. > > Anybody using DB views with Sequel or done this before?
It should work fine, other than typecasting may not work correctly (I haven't tested that). If you do: class Album < Sequel::Model end and albums is a view instead of a table, it will just use the albums view. To Sequel, the model's table name is just an identifier, so it can reference a view or a table. Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-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/sequel-talk?hl=en.
