zeddi-5tc4TXWwyLM@public.gmane.org
2005-Jan-22 11:01 UTC
Problem running rails with postgresql
Hi. I''am in the middle of reading cool possibilities review of rubyonrail at http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html. The review is based on mysql database, but i have postgresql on my linux box. Installing and configuration ruby-postgres wasn''t very hard. But I finally stuck. The question is: Does anyone has something like that ? ActiveRecord::StatementInvalid in Recipe#index Showing /usr/lib/ruby/gems/1.8/gems/actionpack-1.3.1/lib/action_controller/templates/scaffolds/list.rhtml where line #5 raised ERROR: Namespace "information_schema" does not exist : SELECT column_name, column_default, character_maximum_length, data_type FROM information_schema.columns WHERE table_catalog = ''cookbook'' AND table_schema = ''public'' AND table_name = ''recipes''; Does anyone knowns what to do with it ? Is seems to be postgres problem, he''s trying to access non existent table. How to create this table ? Meybe this table is automagically created, but has diffrent name ? I created table using SQL syntax: create table recipes (id int not null primary key, title varchar(200), instructions text); If I asked this question in a bad way, provided too less information or anything else feel free to flame me. Sorry for my english chears, zeddi
zeddi-5tc4TXWwyLM@public.gmane.org wrote:> Hi. > > I''am in the middle of reading cool possibilities review of rubyonrail at > http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html. The review is based > on mysql database, but i have postgresql on my linux box. Installing and > configuration ruby-postgres wasn''t very hard. But I finally stuck. > The question is: > Does anyone has something like that ? > > ActiveRecord::StatementInvalid in Recipe#index > Showing /usr/lib/ruby/gems/1.8/gems/actionpack-1.3.1/lib/action_controller/templates/scaffolds/list.rhtml > where line #5 raised ERROR: Namespace "information_schema" does not exist : > SELECT column_name, column_default, character_maximum_length, data_type FROM > information_schema.columns WHERE table_catalog = ''cookbook'' AND table_schema > = ''public'' AND table_name = ''recipes''; >It looks like you might have too old a version of postgresql. What version are you running? I''m not sure at what version the schema tables were changed, but you should be using something in the 7.4 area. -Scott _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
* zeddi-5tc4TXWwyLM@public.gmane.org <zeddi-5tc4TXWwyLM@public.gmane.org> [0157 10:57]:> Hi. > > I''am in the middle of reading cool possibilities review of rubyonrail at > http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html. The review is based > on mysql database, but i have postgresql on my linux box. Installing and > configuration ruby-postgres wasn''t very hard. But I finally stuck. > The question is: > Does anyone has something like that ? > > ActiveRecord::StatementInvalid in Recipe#index > Showing /usr/lib/ruby/gems/1.8/gems/actionpack-1.3.1/lib/action_controller/templates/scaffolds/list.rhtml > where line #5 raised ERROR: Namespace "information_schema" does not exist : > SELECT column_name, column_default, character_maximum_length, data_type FROM > information_schema.columns WHERE table_catalog = ''cookbook'' AND table_schema > = ''public'' AND table_name = ''recipes'';What version of postgresql? I''ve had the ToDo tutorial working on postgres 7.4 - are you using 8? -- ''Blackmail''s such an ugly word. I prefer extortion. The x makes it sound cool.'' -- Bender Rasputin :: Jack of All Trades - Master of Nuns
zeddi-5tc4TXWwyLM@public.gmane.org
2005-Jan-22 14:14 UTC
Re: Problem running rails with postgresql
> > What version of postgresql? >psql (PostgreSQL) 7.3.6
zeddi-5tc4TXWwyLM@public.gmane.org wrote:>>What version of postgresql? >> > > > psql (PostgreSQL) 7.3.6I believe that the query ActiveRecord uses to get schema information is incompatible with the 7.3 series. You should upgrade to at least the latest 7.4 series. I have not tried 8.0 yet to know if AR works with it, has anybody else? -Scott _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
I''m running into a problem with some relations between tables that also
use
the single table inheritance. As I''m new to Ruby and Rails (migrating
from
the Python/PHP/ASP worlds) I''m hoping it''s something simple
that I''m
overlooking, but any help is much appreciated.
Here''s the Scenario...
I have a content table with the following model code (it has the
"type"
column to do the table inheritance, and an "id" field for the pkey)
class Content < ActiveRecord::Base
has_many :fields
end
class Page < Content
end
Then I have a fields table which holds the additional content fields linked
to the content table (this table also has the single table inheritance, has
an "id" field for the pkey and links to the content table through
"content_id")
class Field < ActiveRecord::Base
belongs_to :content
end
class LongText < ContentField
end
class ShortText < ContentField
end
For testing in the controller I have this:
def pages
@content = Content.find(1)
@fields = @content.fields
render_text "Page Field Name: " + @fields[0].value
end
When I run the controller I get the following error:
NoMethodError in Contents#pages
undefined method `fields'' for #<Page:0x40503880>
If I change the name of the "type" column in the "contents"
table in the
database (which is PostGres if it makes any difference) to be something
else, then everything works as expected. Except of course I no longer have
the single table inheritance in the contents table...
Thanks,
--James