Rails 开拓者改革:`initialize':未初始化常量 Uber::Options (NameError)

Rails Trailblazer Reform: `initialize': uninitialized constant Uber::Options (NameError)

我正在尝试让 Trailblazer-Rails 在我的 rails 项目中工作。

但改革似乎发生了一些奇怪的事情gem。

我无法从 rails 开始 "rails s"。 它响应错误:

"/home/dragonslayer/.rvm/gems/ruby-2.3.1/gems/reform-2.2.3/lib/reform/form/populator.rb:12:in `initialize': 未初始化常量Uber::Options(名称错误) “

但是当我删除我的合同时,它起作用了。 当我删除合同时,它有时似乎无法找到我的操作。

我的操作是这样的:

class GuildApplication::Create < Trailblazer::Operation

 step Model( GuildApplication, :new)
 step Contract::Build( constant: GuildApplication::Contract::Create)
 step Contract::Validate()
 step :set_status_to_pending
 step Contract::Persist()

 def set_status_to_pending(options)
  options["model"].status = :pending
 end
end

我的合同:

module GuildApplication::Contract
 class Create < Reform::Form

  property :first_name
  property :last_name
  property :email
  property :username
  property :server
  property :spec
  property :armory
  property :klass
  property :played
  property :klass_played
  property :bio
  property :raid_experience
  property :reason
  property :old_guild
  property :progress_raid
  property :attendance
  property :other

  property :screenshot, virtual: true

  extend Paperdragon::Model::Writer
  processable_writer :image
  property :image_meta_data

  validates :first_name, :last_name, :email, :username, :server, presence: true
  validates :screenshot, file_size: { less_than: 2.megabytes}, file_content_type: { allow: ['image/jpeg', 'image/png'] }
  validates_uniqueness_of :email
  validates_uniqueness_of :username
 end
end

我的控制器:

class GuildApplicationsController < ApplicationController

 def new
  render html: cell(GuildApplication::Cell::Register, nil, layout: Familylegion::Cell::LandingPage)
 end

 def create
  run GuildApplication::Create
 end
end

我的gem文件:

source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
 "https://github.com/#{repo_name}.git"
end

gem 'rails', '~> 5.0.1'
gem 'mysql2', '>= 0.3.18', '< 0.5'
gem 'puma', '~> 3.0'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'
gem 'therubyracer', platforms: :ruby
gem 'jquery-rails'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
#gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
gem 'rbattlenet'
gem 'slim'
gem "reform"
gem "reform-rails"
gem "trailblazer"
gem "trailblazer-rails"
gem "cells"
gem "cells-rails"
gem "trailblazer-cells"
gem 'cells-slim'
gem 'dry-validation'
gem 'semantic-ui-sass', github: 'doabit/semantic-ui-sass'
gem 'rmagick'
gem 'paperdragon'
gem 'file_validators'

gem 'capistrano-rails', group: :development

group :development, :test do
  gem 'byebug', platform: :mri
end

group :development do
 # Access an IRB console on exception pages or by using <%= console %>    anywhere in the code.
 gem 'web-console', '>= 3.3.0'
 gem 'listen', '~> 3.0.5'
 # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
 gem 'spring'
 gem 'spring-watcher-listen', '~> 2.0.0'
end

此问题已在改革 2.2.4 中修复,请参阅 https://github.com/trailblazer/reform/issues/422