0
我已經寫了這個生成器代碼,但它返回'不能將nil轉換爲字符串'當我在清單內部調用m.directory。任何人都知道發生了什麼?Rails生成器m.directory返回不能轉換零字符串
class AuthGenerator < Rails::Generator::NamedBase
attr_reader :user_class_name
def initialize(runtime_args, runtime_options={})
@user_class_name="User"
@controller_class_name="AccountController"
@user_class_file_name="#{@user_class_name}.rb"
@controller_class_file_name="#{@controller_class_name}.rb"
end
def manifest
record do |m|
m.class_collisions @controller_class_name, @user_class
puts @user_class_name
m.directory File.join('app/models', @user_class_name)
end
end
末