On Tue, Jan 8, 2013 at 7:41 PM, Colin Law <[email protected]> wrote:
> On 8 January 2013 14:03, DHAMODHARAN N <[email protected]> wrote: > > > > > > > > On Tue, Jan 8, 2013 at 6:58 PM, Colin Law <[email protected]> > wrote: > >> > >> On 8 January 2013 12:33, DHAMODHARAN N <[email protected]> wrote: > >> > Migration1: > >> > class RenameTableForMailchimp < ActiveRecord::Migration > >> > def change > >> > rename_table :ctct_contacts, :contacts > >> > end > >> > end > >> > > >> > Migration2: > >> > class AddTypeColumnForMailchimp < ActiveRecord::Migration > >> > def change > >> > add_column :contacts, :type, :string > >> > end > >> > end > >> > >> Please don't top post, it makes it difficult to follow the thread. > >> Insert your replies inline at appropriate points. > >> > >> The error you showed came from > >> > >> > /home/dhamodharan/project/application20Web/db/migrate/20121128075457_add_ctct_contact_uniqueness.rb:9:in > >> `change' so it might be helpful to show that migration. I presume the > >> migrations above ran successfully and that you have checked in the > >> database that the table has been renamed and the type column added ok. > >> > > > > Thanks Lot Colin Law, > > > > Cause of issue is in that migration have data migration script(like > > invoking CtctContact model) but current code CtctContact base class > Contact > > so it try to search contact table. > > Sorry, I still don't know what you mean as you still have not posted > the code that is generating the error. If you still have a problem > post the full code of the migration rb file and the full error that > you are seeing when you run rake db:migrate. > > Colin > sample code: def change add_index :ctct_contacts, [:ctct_account_id, :email_address], :unique => true obfuscate_current_contacts end def obfuscate_current_contacts CtctContact.transaction do CtctContact.find(:all).each do |c| #some code with c object end end end Problem solved commenting obfuscate_current_contacts method invoking. Cause of issue we are invoking current code base CtctContact base class Contact so its seeking contacts table. But our table rename migration later. Thanks, Dhamodharan > -- > 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

