How to copy views from development db to test db while running rake?

Hi guys , I am stuck at a particular situation . When I run
rake db:test:clone_structure ,the test db is not copying the views that
are in the development db.So is there any solution for this problem so
that I can get the views in test db also . I have tried using rake
db:test:purge and rake db:test:clone as well. But it doesn’t support me
as well.

Hope I get some suggestions here ,

Thanks in Advance .

@ Marnen Laibow-Koser Thanks Marnen for the reply. I will look into it
and
will let you know.

Thanks ,
karthik

On Thu, Jan 20, 2011 at 10:27 AM, Marnen Laibow-Koser

Karthik l Bhat wrote in post #976157:

Hi guys , I am stuck at a particular situation . When I run
rake db:test:clone_structure ,the test db is not copying the views that
are in the development db.So is there any solution for this problem so
that I can get the views in test db also . I have tried using rake
db:test:purge and rake db:test:clone as well. But it doesn’t support me
as well.

Hope I get some suggestions here ,

The problem is probably that the views aren’t getting written to the
db/schema.rb file, which is where Rake’s clone tasks get there DB
structure info from. I’d recommend installing the rails_sql_views
plugin, then doing rake db:schema:dump to get all the views into the
schema file. If that doesn’t work, maybe you should set the schema
dumper format to :sql.

Thanks in Advance .

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Sent from my iPhone

There is one possible solution which can be done. That is write a script
that creates the views and keep it in your fixtures folder .Later call
this particular file in the corresponding test files .
bash #{RAILS_ROOT}/test/fixtures/YOURFILENAME.sh #{ActiveRecord::Base.configurations[RAILS_ENV]['username']}/#{ActiveRecord::Base.configurations[RAILS_ENV]['password']}

This when added in the test controller the script will be executed and
the view will be created .This is bit a crude method though.
There is one more solution to this problem where in we can extend the
rake class and modify the lib. But i need to explore more inorder to
implement this.

Regards ,
Karthik