【问题标题】:Unable to create an user with "tenant"无法使用“租户”创建用户
【发布时间】:2015-03-02 11:31:31
【问题描述】:

我正在使用宝石 milia 并进行设计。

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@ggfdgfd.com', :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@ggfdgfd.com' 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'
.....

【问题讨论】:

    标签: ruby-on-rails ruby devise acts-as-tenant


    【解决方案1】:

    看起来很像:https://github.com/dsaronin/milia/issues/5

    您已经安装了 Milia gem 的旧 v0.3.34。也许运行bundle update milia 可以解决这个问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-06-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-15
      • 2012-05-22
      相关资源
      最近更新 更多