使用STI设计模式使用Mongoid声明的现有字段的未定义方法仅与Zeus进行Rspec失败
使用Rails 4、Zeus 0.13.3、rspec Rails edge和mongoid edge 简单STI模型: 文件使用STI设计模式使用Mongoid声明的现有字段的未定义方法仅与Zeus进行Rspec失败,rspec,ruby-on-rails-4,sti,mongoid3,zeus,Rspec,Ruby On Rails 4,Sti,Mongoid3,Zeus,使用Rails 4、Zeus 0.13.3、rspec Rails edge和mongoid edge 简单STI模型: 文件my_model.rb位于/model目录中 class MyModel include Mongoid::Document field :my_field end class MyModel class MySti << ::MyModel field :some_other_field end end 文件my_sti.r
my_model.rb
位于/model
目录中
class MyModel
include Mongoid::Document
field :my_field
end
class MyModel
class MySti << ::MyModel
field :some_other_field
end
end
文件my_sti.rb
位于/model/my_model
目录中
class MyModel
include Mongoid::Document
field :my_field
end
class MyModel
class MySti << ::MyModel
field :some_other_field
end
end
classmymodel
类MySti添加代理是否有效
从文件
class Greeter < ActiveRecord::Base
def hello
'hello'
end
def goodbye
'goodbye'
end
end
class Foo < ActiveRecord::Base
belongs_to :greeter
delegate :hello, to: :greeter
end
Foo.new.hello # => "hello"
Foo.new.goodbye # => NoMethodError:
class迎宾员“你好”
Foo.new.再见#=>NoMethodError:
经历同样的事情。碰撞