RuntimeError: ERROR C42P01 Mrelation

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

On 5-Mar-07, at 9:49 PM, Tanzanite T. wrote:

database server.i have over 50 database views which ithought rails
would
support, just like tables.

I haven’t used rails with postgres views, but this wiki article may
help you along:

http://wiki.rubyonrails.org/rails/pages/HowtoUsePostgresViewsAsTables

plus this article show how views can be used for R, but no CUD. mmmm.
chew. mmmm.

http://johnwilger.com/2005/9/29/class-table-inheritance-in-rails-with-
postgresql

cheers,
Jodi

On 5-Mar-07, at 9:49 PM, Tanzanite T. wrote:

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

rgds
Tanzanite

yep. didn’t read that bit about the plugin you’re using. yikes.

might want to verify it’s compatibility with your version of rails -
plus you could also go to trunk to see if it works closer to the edge.

Jodi