Rails::Generators::GeneratedAttribute 的 Rails 3.0.0.beta2 问题 [英] Rails 3.0.0.beta2 problem with Rails::Generators::GeneratedAttribute

查看:30
本文介绍了Rails::Generators::GeneratedAttribute 的 Rails 3.0.0.beta2 问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我正在尝试使用 Ryan Bates 的 Nifty Generators 的 rails3 分支.现在我之前在 beta1 中使用过这个 gem 并且它工作正常,但是在升级到 beta2 之后我遇到了一个非常奇怪的错误.

So I am trying to use the rails3 branch of Nifty Generators by Ryan Bates. Now I've used this gem before with beta1 and its worked, but after upgrading to beta2 I've been getting a very wierd error.

lib/generators/nifty/scaffold/scaffold_generator.rb:35:in `block in initialize': uninitialized constant Rails::Generators::GeneratedAttribute (NameError)

发生这种情况的代码:

args_for_c_m.each do |arg|
  if arg == '!'
    options[:invert] = true
  elsif arg.include?(':')
    @model_attributes << Rails::Generators::GeneratedAttribute.new(*arg.split(':'))
  else
    @controller_actions << arg
    @controller_actions << 'create' if arg == 'new'
    @controller_actions << 'update' if arg == 'edit'
  end
end

现在我已经看到很多 gems 中使用了 GeneratedAttribute,所以我很困惑它为什么会损坏.我不确定,但我认为这与 beta2 有关.

Now I've seen GeneratedAttribute used in many gems before, so I'm confused on why its breaking. I'm not sure, but I think this has to do with beta2.

所以我的问题是我这边的某个 Rails 问题吗?如果这是我的想法,我可能做错了什么?

So my question is this a Rails problem of something on my end? If it is on my end any ideas what I have may done wrong?

谢谢.

推荐答案

可能是 beta2 错误或 rails 不再自动加载该模块.尝试添加

Probably either a beta2 bug or rails doesn't load that module automatically anymore. Try adding

require 'rails/generators/generated_attribute'

这篇关于Rails::Generators::GeneratedAttribute 的 Rails 3.0.0.beta2 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆