2015-03-02 162 views
0

我正在使用寶石和設計。無法使用「租戶」創建用戶

class User < ActiveRecord::Base 
    # ... 
    acts_as_universal_and_determines_account 
    #... 
end 

class Tenant < ActiveRecord::Base 

    acts_as_universal_and_determines_tenant 

    def self.create_new_tenant(params) 
    #.... 
end 

    create_table "tenants_users", :id => false, :force => true do |t| 
    t.integer "tenant_id" 
    t.integer "user_id" 
    end 

僅用於測試的目的,我要創建用戶:

u1 = User.new(:email => '[email protected]', :password => 'password', :password_confirmation => 'password') 

Tenant.create!(cname: 'cname1') 

u1.save! 

的錯誤是:

> u1.save! 
    (0.1ms) begin transaction 
    User Exists (9.3ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = '[email protected]' LIMIT 1 
    (0.1ms) rollback transaction 
NameError: uninitialized constant Control 
    from /Users/alex/.rvm/gems/ruby-1.9.3-p547/gems/milia-0.3.34/lib/milia/base.rb:61:in `block in acts_as_universal' 
..... 

回答