Karthik l Bhat
2011-Jan-20 04:08 UTC
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 . -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Marnen Laibow-Koser
2011-Jan-20 04:57 UTC
Re: How to copy views from development db to test db while running rake ?
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 marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org Sent from my iPhone -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Karthik Bhat
2011-Jan-20 05:00 UTC
Re: Re: How to copy views from development db to test db while running rake ?
@ 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 <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:> 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 > marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > > Sent from my iPhone > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Karthik l Bhat
2011-Jan-20 11:46 UTC
Re: How to copy views from development db to test db while running rake ?
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 -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.