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</h1>
<%for myview in @myviews -%>
<div class= "entry">
<h3> Title: <%= h(view.name)%> </h3>
</div>
<%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
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
On 5-Mar-07, at 9:49 PM, Tanzanite Tanzanite wrote:> > 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. > >> > 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 > >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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 5-Mar-07, at 9:49 PM, Tanzanite Tanzanite wrote:> > 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 > >> 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---