Hi Guys,
Am trying to map a database ‘view’ to activerecord but i get the
following error
"RuntimeError: ERROR C42P01 Mrelation “gff3view” does not exist
Fnamespace.c L200 RRangeVarGetRelid: SELECT * FROM gff3view "
Am developing an application based on a legacy database using Postgresql
database server.i have over 50 database views which ithought rails would
support, just like tables.
This is what i have done;
i installed the gem rails_sql_views which is supposed to among many
other things.
Implement view support for: MySQL and PostgreSQL
Unit tests included
i then incuded this two lines in my enviroment.rb file
require_gem ‘rails_sql_views’
require ‘rails_sql_views’
then in my model i wrote this:
class Myview < ActiveRecord::Base
def self.find_feature
find(:all)
end
end
in my controller i have:
class DisplayController < ApplicationController
def index
@myviews = Myview.find_feature
end
end
and in my index.rhtml i have
h1>Features Display
<%for myview in @myviews -%>
<div class= "entry">
Title: <%= h(view.name)%>
<%end%>
Please can someone tell me where the problem is? or is that database
views are not supported. but i thought they should be mapped just like
tables.(i may be wrong)
Has someone else encoured this patriculary while working with a legacy
database like am doing?
rgds
Tanzanite