{"action":"created","issue":{"url":"https://api.github.com/repos/paulelliott/fabrication/issues/248","labels_url":"https://api.github.com/repos/paulelliott/fabrication/issues/248/labels{/name}","comments_url":"https://api.github.com/repos/paulelliott/fabrication/issues/248/comments","events_url":"https://api.github.com/repos/paulelliott/fabrication/issues/248/events","html_url":"https://github.com/paulelliott/fabrication/issues/248","id":71986038,"number":248,"title":"2.13.0/1 error when generating a model with fabrication as the fixture replacement under pg/Postgresql","user":{"login":"ninjarobert","id":10180412,"avatar_url":"https://avatars.githubusercontent.com/u/10180412?v=3","gravatar_id":"","url":"https://api.github.com/users/ninjarobert","html_url":"https://github.com/ninjarobert","followers_url":"https://api.github.com/users/ninjarobert/followers","following_url":"https://api.github.com/users/ninjarobert/following{/other_user}","gists_url":"https://api.github.com/users/ninjarobert/gists{/gist_id}","starred_url":"https://api.github.com/users/ninjarobert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ninjarobert/subscriptions","organizations_url":"https://api.github.com/users/ninjarobert/orgs","repos_url":"https://api.github.com/users/ninjarobert/repos","events_url":"https://api.github.com/users/ninjarobert/events{/privacy}","received_events_url":"https://api.github.com/users/ninjarobert/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-29T20:47:11Z","updated_at":"2015-04-30T02:24:15Z","closed_at":"2015-04-30T02:20:05Z","body":"Hello,\r\n\r\nWhen you setup Fabrication as the fixture replacement as follows,\r\n\r\n```\r\n    config.generators do |g|\r\n      g.test_framework      :rspec, fixture: true, fixture_replacement: 'fabrication'\r\n      g.fixture_replacement :fabrication, dir: 'spec/fabricators'\r\n    end\r\n\r\n```\r\n\r\nand you generate a model as follows,\r\n\r\n```\r\nrails g model Account\r\n```\r\n\r\na database error occurs under Postgresql that states the accounts relation cannot be found.\r\n\r\n```\r\nactiverecord-4.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:592:in `async_exec': PG::UndefinedTable: ERROR:  relation \"accounts\" does not exist (ActiveRecord::StatementInvalid)\r\nLINE 5:                WHERE a.attrelid = '\"accounts\"'::regclass\r\n                                          ^\r\n:               SELECT a.attname, format_type(a.atttypid, a.atttypmod),\r\n                     pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod\r\n                FROM pg_attribute a LEFT JOIN pg_attrdef d\r\n                  ON a.attrelid = d.adrelid AND a.attnum = d.adnum\r\n               WHERE a.attrelid = '\"accounts\"'::regclass\r\n                 AND a.attnum > 0 AND NOT a.attisdropped\r\n               ORDER BY a.attnum\r\n```\r\n\r\nI think this is because the updated generators attempt to hit the database looking for the matching table (the copy_attributes_from_model method), and pg throws an error because the table doesn't exist."},"comment":{"url":"https://api.github.com/repos/paulelliott/fabrication/issues/comments/97635939","html_url":"https://github.com/paulelliott/fabrication/issues/248#issuecomment-97635939","issue_url":"https://api.github.com/repos/paulelliott/fabrication/issues/248","id":97635939,"user":{"login":"paulelliott","id":58612,"avatar_url":"https://avatars.githubusercontent.com/u/58612?v=3","gravatar_id":"","url":"https://api.github.com/users/paulelliott","html_url":"https://github.com/paulelliott","followers_url":"https://api.github.com/users/paulelliott/followers","following_url":"https://api.github.com/users/paulelliott/following{/other_user}","gists_url":"https://api.github.com/users/paulelliott/gists{/gist_id}","starred_url":"https://api.github.com/users/paulelliott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulelliott/subscriptions","organizations_url":"https://api.github.com/users/paulelliott/orgs","repos_url":"https://api.github.com/users/paulelliott/repos","events_url":"https://api.github.com/users/paulelliott/events{/privacy}","received_events_url":"https://api.github.com/users/paulelliott/received_events","type":"User","site_admin":false},"created_at":"2015-04-30T02:24:15Z","updated_at":"2015-04-30T02:24:15Z","body":"Just released version 2.13.2 with this fix. Good catch!"}}