Undefined Method 'views'

Hi,

I have installed rails_sql_views-0.1.0.gem in jruby\bin directory.

I referred this link
http://activewarehouse.rubyforge.org/rails_sql_views/
to create a database view

Code to create a view

class CreateViews < ActiveRecord::Migration
def self.up
create_view(:v_photo, “select description, content_type from photo”)
do |t|
t.column :description
t.column :content_type
end
end

def self.down
drop_view(:v_photo)
end
end

I got the view created successfully, and also got this error

E:\Work\JRuby\MyApp>jruby --command rake environment
RAILS_ENV=development_postg
res db:migrate
(in E:/Work/JRuby/MyApp)
== CreateViews: migrating

– create_view(:v_photo, “select description, content_type from photo”)
-> 0.7830s
== CreateViews: migrated (0.7830s)

rake aborted!
undefined method `views’ for
#<ActiveRecord::ConnectionAdapters::JdbcAdapter:0x1
bdcbb2 @last_verification=0, @runtime=0, @config={:password=>nil,
:driver=>“org.
postgresql.Driver”, :adapter=>“jdbc”, :username=>“efipgsql”,
:allow_concurrency=

false, :url=>“jdbc:postgresql://localhost:5432/MyApp”}, @connection=#<ActiveRec
ord::ConnectionAdapters::JdbcConnection:0x1756db3
@native_types={:datetime=>{:na
me=>“timestamp”}, :text=>{:name=>“text”},
:timestamp=>{:name=>“timestamp”}, :boo
lean=>{:name=>“bool”, :limit=>1}, :time=>{:name=>“time”},
:date=>{:name=>“date”}
, :decimal=>{:name=>“numeric”, :limit=>9}, :string=>{:name=>“varchar”,
:limit=>9
}, :float=>{:name=>“float4”}, :binary=>{:name=>“bytea”},
:integer=>{:name=>"int4
", :limit=>9}}, @config={:password=>nil,
:driver=>“org.postgresql.Driver”, :adap
ter=>“jdbc”, :username=>“efipgsql”, :allow_concurrency=>false,
:url=>“jdbc:postg
resql://localhost:5432/MyApp”}, @stmts={},
@tps={:datetime=>{:name=>“timestamp”}
, :boolean=>{:name=>“bool”, :limit=>nil},
:timestamp=>{:name=>“timestamp”}, :tex
t=>{:name=>“text”}, :date=>{:name=>“date”}, :time=>{:name=>“time”},
:decimal=>{:
name=>“numeric”, :limit=>9}, :primary_key=>“serial primary key”,
:float=>{:name=
“float4”}, :string=>{:name=>“varchar”, :limit=>255}, :binary=>{:name=>“bytea”},
:integer=>{:name=>“int4”, :limit=>nil}},
@connection=#<Java::OrgPostgresqlJdbc3
::Jdbc3Connection:0x121ea24
@[email protected]
fa85>,
@adapter=#<ActiveRecord::ConnectionAdapters::JdbcAdapter:0x1bdcbb2
…>>,
@logger=#<Logger:0x192e317 @logdev=#<Logger::LogDevice:0x7b0f4d
@filename=“E:/W
ork/JRuby/MyApp/config/…/log/development_postgres.log”,
@mutex=#<Logger::LogDev
ice::LogDeviceMutex:0x12996d6 @mon_count=0, @mon_owner=nil,
@mon_waiting_queue=[
], @mon_entering_queue=[]>, @shift_age=0,
@dev=#<File:E:/Work/JRuby/MyApp/config
/…/log/development_postgres.log>, @shift_size=1048576>, @formatter=nil,
@progna
me=nil, @default_formatter=#<Logger::Formatter:0x27de24
@datetime_format=nil>, @
level=0>>

Appreciate your help !!

Thanks,
John

Any solution to fix this error?

Thanks,
John

John E. wrote:

Hi,

I have installed rails_sql_views-0.1.0.gem in jruby\bin directory.

I referred this link
http://activewarehouse.rubyforge.org/rails_sql_views/
to create a database view

Code to create a view

class CreateViews < ActiveRecord::Migration
def self.up
create_view(:v_photo, “select description, content_type from photo”)
do |t|
t.column :description
t.column :content_type
end
end

def self.down
drop_view(:v_photo)
end
end

I got the view created successfully, and also got this error

E:\Work\JRuby\MyApp>jruby --command rake environment
RAILS_ENV=development_postg
res db:migrate
(in E:/Work/JRuby/MyApp)
== CreateViews: migrating

– create_view(:v_photo, “select description, content_type from photo”)
-> 0.7830s
== CreateViews: migrated (0.7830s)

rake aborted!
undefined method `views’ for
#<ActiveRecord::ConnectionAdapters::JdbcAdapter:0x1 …

Appreciate your help !!

Thanks,
John

John E. wrote:

Any solution to fix this error?

Thanks,
John

put this in environment.rb:

require ‘rails_sql_views’
gem ‘rails_sql_views’

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs