Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Rails recognize db view?

Is there a way that to access my db view as a table for a model?

like image 441
usmanali Avatar asked Nov 14 '22 21:11

usmanali


1 Answers

Yes, you can use views just fine, they behave just like tables in ActiveRecord. I don't know what database you're using, but I use them in Oracle and haven't had a problem.

The only difference is that if you want to have your migrations automatically create them, you'll have to forego the typical create_table and instead execute SQL statements to create it.

like image 135
Mark Thomas Avatar answered Dec 22 '22 06:12

Mark Thomas