I’ve heard that you can tie a model in rails to a database view (instead of a table as per usual) and that this is dome simply by creating a view with the name that the model’s table would ordinarily have.
I am not getting this to work in rails 3.0.5 with PostgreSQL 9.
Is there something I am missing?
Rails in it’s postgresql adapter didn’t look in
pg_viewsview for it’s models.You should name views with some names, your normal models do.
You could create little hack, like this to solve this problem:
Place this into file
RAILS_ROOT/config/initializers/postgresql_view_support.rb.PS:
This code is for Rails 3.0.5.