Skip to content
This repository has been archived by the owner on Jun 16, 2020. It is now read-only.

wrap two scopes in procs to fix migration/startup issues #6

Merged
merged 1 commit into from
Feb 5, 2012

Conversation

ahamid
Copy link

@ahamid ahamid commented Feb 5, 2012

Two class_evald bitmask_attributes scopes are not wrapped in procs, which results in migration failures as they attempt to interact with missing tables:

/home/aaron/.rvm/gems/ruby-1.9.3-p0@menagerie-pm-3.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/postgresql_adapter.rb:1021:in `async_exec': PGError: ERROR:  relation "users" does not exist (ActiveRecord::StatementInvalid)
LINE 4:              WHERE a.attrelid = '"users"'::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 = '"users"'::regclass
               AND a.attnum > 0 AND NOT a.attisdropped
             ORDER BY a.attnum

The lines in question are:

https://github.com/joelmoss/bitmask_attributes/blob/master/lib/bitmask_attributes/definition.rb#L131
https://github.com/joelmoss/bitmask_attributes/blob/master/lib/bitmask_attributes/definition.rb#L149

This patch wraps those in procs which allows db migrations to run.
Tests still pass.

joelmoss added a commit that referenced this pull request Feb 5, 2012
wrap two scopes in procs to fix migration/startup issues
@joelmoss joelmoss merged commit ab4bfda into joelmoss:master Feb 5, 2012
@joelmoss
Copy link
Owner

joelmoss commented Feb 5, 2012

cheers!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants