{"id":6999,"date":"2014-05-16T05:58:25","date_gmt":"2014-05-16T05:58:25","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/05\/16\/rails-database-chicken-and-egg-error-collection-of-common-programming-errors\/"},"modified":"2014-05-16T05:58:25","modified_gmt":"2014-05-16T05:58:25","slug":"rails-database-chicken-and-egg-error-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/05\/16\/rails-database-chicken-and-egg-error-collection-of-common-programming-errors\/","title":{"rendered":"Rails database chicken and egg error-Collection of common programming errors"},"content":{"rendered":"<p>Running the migration crashes because the dynamic method <code>find_by_configuration_set_and_key<\/code> is undefined. This dynamic method will only be defined after the migration is executed as the migration is renaming column <code>set<\/code> to <code>configuration_set<\/code>.<\/p>\n<p>I have now found a way to execute the migration although it&#8217;s not perfect.<\/p>\n<p>The code where method <code>find_by_configuration_set_and_key<\/code> is called lays within a plugin. I changed environment.rb so that the plugin is not loaded and that allowed me to run the Rails database migration. Then I put it back and restarted the app.<\/p>\n<p>This solution is better then using the mysql client but still a hack. Thanks to everyone for the nice ideas and discussion.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Running the migration crashes because the dynamic method find_by_configuration_set_and_key is undefined. This dynamic method will only be defined after the migration is executed as the migration is renaming column set to configuration_set. I have now found a way to execute the migration although it&#8217;s not perfect. The code where method find_by_configuration_set_and_key is called lays within [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6999","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6999","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6999"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6999\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6999"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6999"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6999"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}