Creating a View(database) with Migration


Is there a way to create a view using ruby migration? I could run a
quick sql script to create a view, but I wanted to do this with
migration to make it easier during deployment.


You can put execute statements in your migration.

I was looking for something equivalent to create_table, but this is
pretty handy. Thanks!

I'd offer the observation that scopes in active record can easily
serve the function of views in many cases.

Yes, there is a plugin for your purpose


@Michael Schuerig
Thanks for the info. I'll have some warehousing to do in the future,
so rails_sql_view will be perfect!

@Rick DeNatale
I have yet to make use of scopes (still learning... ). Thanks for
pointing me in that direction. I just read this page:
Looks like this is what I should do for what I'm trying to do.. pretty