Hi Colin Law,

Existin code ctct_contact.rb => class CtctContact < Contact

After changes ctct_contact.rb => class CtctContact < ActiveRecord::Base

Above changes works fine for me but we cant proceed with that changes right?


Trace :

-- add_index(:ctct_contacts, [:ctct_account_id, :email_address],
{:unique=>true})
   -> 0.0732s
rake aborted!
An error has occurred, this and all later migrations canceled:

PG::Error: ERROR:  relation "contacts" does not exist
LINE 4:              WHERE a.attrelid = '"contacts"'::regclass
                                        ^
:             SELECT a.attname, format_type(a.atttypid, a.atttypmod),
d.adsrc, a.attnotnull
              FROM pg_attribute a LEFT JOIN pg_attrdef d
                ON a.attrelid = d.adrelid AND a.attnum = d.adnum
             WHERE a.attrelid = '"contacts"'::regclass
               AND a.attnum > 0 AND NOT a.attisdropped
             ORDER BY a.attnum
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:1151:in
`async_exec'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:1151:in
`exec_no_cache'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:664:in
`block in exec_query'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:280:in
`block in log'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activesupport-3.2.6/lib/active_support/notifications/instrumenter.rb:20:in
`instrument'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:275:in
`log'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/newrelic_rpm-3.5.4.33/lib/new_relic/agent/instrumentation/active_record.rb:32:in
`block in log_with_newrelic_instrumentation'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/newrelic_rpm-3.5.4.33/lib/new_relic/agent/method_tracer.rb:242:in
`trace_execution_scoped'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/newrelic_rpm-3.5.4.33/lib/new_relic/agent/instrumentation/active_record.rb:29:in
`log_with_newrelic_instrumentation'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:663:in
`exec_query'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:1276:in
`column_definitions'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:859:in
`columns'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/connection_adapters/schema_cache.rb:12:in
`block in initialize'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/model_schema.rb:228:in
`yield'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/model_schema.rb:228:in
`default'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/model_schema.rb:228:in
`columns'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/model_schema.rb:237:in
`columns_hash'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/inheritance.rb:19:in
`descends_from_active_record?'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/inheritance.rb:25:in
`finder_needs_type_condition?'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/base.rb:455:in
`relation'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/scoping/named.rb:37:in
`scoped'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/querying.rb:5:in
`find'
/home/dhamodharan/project/application20Web/db/migrate/20121128075457_add_ctct_contact_uniqueness.rb:14:in
`block in obfuscate_current_contacts'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in
`transaction'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/transactions.rb:208:in
`transaction'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/newrelic_rpm-3.5.4.33/lib/new_relic/agent/method_tracer.rb:493:in
`block in transaction_with_trace_ActiveRecord_self_name_transaction'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/newrelic_rpm-3.5.4.33/lib/new_relic/agent/method_tracer.rb:242:in
`trace_execution_scoped'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/newrelic_rpm-3.5.4.33/lib/new_relic/agent/method_tracer.rb:488:in
`transaction_with_trace_ActiveRecord_self_name_transaction'
/home/dhamodharan/project/application20Web/db/migrate/20121128075457_add_ctct_contact_uniqueness.rb:13:in
`obfuscate_current_contacts'
/home/dhamodharan/project/application20Web/db/migrate/20121128075457_add_ctct_contact_uniqueness.rb:9:in
`change'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/migration.rb:407:in
`block (2 levels) in migrate'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/migration.rb:407:in
`block in migrate'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:123:in
`with_connection'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/migration.rb:389:in
`migrate'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/migration.rb:528:in
`migrate'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/migration.rb:720:in
`block (2 levels) in migrate'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/migration.rb:775:in
`call'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/migration.rb:775:in
`block in ddl_transaction'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in
`transaction'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/transactions.rb:208:in
`transaction'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/newrelic_rpm-3.5.4.33/lib/new_relic/agent/method_tracer.rb:493:in
`block in transaction_with_trace_ActiveRecord_self_name_transaction'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/newrelic_rpm-3.5.4.33/lib/new_relic/agent/method_tracer.rb:242:in
`trace_execution_scoped'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/newrelic_rpm-3.5.4.33/lib/new_relic/agent/method_tracer.rb:488:in
`transaction_with_trace_ActiveRecord_self_name_transaction'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/migration.rb:775:in
`ddl_transaction'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/migration.rb:719:in
`block in migrate'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/migration.rb:700:in
`each'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/migration.rb:700:in
`migrate'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/migration.rb:570:in
`up'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/migration.rb:551:in
`migrate'
/home/dhamodharan/.rvm/gems/ruby-1.9.2-p180@application20/gems/activerecord-3.2.6/lib/active_record/railties/databases.rake:153:in
`block (2 levels) in <top (required)>'



On Tue, Jan 8, 2013 at 3:10 PM, Colin Law <[email protected]> wrote:

> On 8 January 2013 07:00, DHAMODHARAN N <[email protected]> wrote:
> > Hi Folks,
> >
> > 1. I converting existing model to STI
> > 2. Existing model CtctContact
> > 3. ctct_contacts rename as contacts and add column called type in table.
> > 4. In model modified base class(CtctContact < Contact) during migration
> it's
> > show contacts table not found like that.
>
> Do you mean that it is the migration to change the table name and add
> the type column that is failing?
> Show us the failing code (just the section that is failing) and the
> exact error message and stack trace.
>
> Colin
>
> --
> 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.


Reply via email to