我正在使用从Rails 3生成的引擎,现在当我尝试从Rails运行发电机时,它要求我生成一个新项目。
很明显,无法找到导轨调用ActiveRecord所需的结构,但是我不知道如何修补该问题
rails g migration adding-active-boolean-to-types-and-statuses
产生此:
Usage:
rails new APP_PATH [options]
Options:
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
# Default: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
-m, [--template=TEMPLATE] # Path to some application template (can be a filesystem path or URL)
[--skip-gemfile], [--no-skip-gemfile] # Don't create a Gemfile
-B, [--skip-bundle], [--no-skip-bundle] # Don't run bundle install
-G, [--skip-git], [--no-skip-git] # Skip .gitignore file
[--skip-keeps], [--no-skip-keeps] # Skip source control .keep files
我尝试添加特定路径并获得相同结果:
/usr/bin/rails g migration adding-active-boolean-to-types-and-statuses
答案 0 :(得分:0)
已解决:
原因是项目由于某种原因缺少了bin/rails
文件夹。
必须生成一个新引擎,然后将文件复制/更改为指向正确的引擎文件夹。
这是任何人需要时的内容。
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
ENGINE_ROOT = File.expand_path('../..', __FILE__)
ENGINE_PATH = File.expand_path('../../lib/engine', __FILE__)
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
require 'rails/all'
require 'rails/engine/commands'