`<module:formula>':undefined方法`mattr_accessor'</module:formula>

时间:2014-03-20 00:15:56

标签: ruby-on-rails ruby

我有ruby 2.1.1,rails 4.1.0,formula gem 1.0.0。而且,当我尝试这样做时,我得到了这个错误:

IRB 要求&#39;公式&#39;

错误:

chadd:homebrew-openmw-master chadd$ ruby openmw-bullet.rb
/Users/chadd/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/formula-1.0.0/lib/formula.rb:8:in `<module:Formula>': undefined method `mattr_accessor' for Formula:Module (NoMethodError)
    from /Users/chadd/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/formula-1.0.0/lib/formula.rb:1:in `<top (required)>'
    from /Users/chadd/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `require'
    from /Users/chadd/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
    from /Users/chadd/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'
    from openmw-bullet.rb:1:in `<main>'

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

试试这个:

rails的mattr_accessor方法是由rails的activesupport组件提供的,它不是ruby的一部分,因此需要“active_support”&#39;在你的脚本中然后尝试。