我尝试使用Rails 3.1.3生成模型
rails generate model Blob twit:string
我收到此错误消息
No value provided for required options '--orm'
我正在尝试为这个Ruby Twitter gem https://github.com/sferik/sign-in-with-twitter添加一些东西,所以我真的不知道这个gemfile中的gem(我没有创建)是否需要这些选项。
我的Gemfile中是否有东西需要我完成这些必需的选项以及这些选项是什么?
更新:配置文件夹中没有database.yml文件,所以(在阅读其中一条评论后)我从另一个项目中拿了一个,并将其包含在内,使用sqlite3但是它没有修复问题
source 'https://rubygems.org'
gem 'rails', '~> 3.1.0'
gem 'haml', '~> 3.2.0.alpha'
gem 'omniauth-twitter'
gem 'twitter'
platforms :jruby do
gem 'jruby-openssl'
end
group :assets do
gem 'sass-rails'
gem 'uglifier'
end
gem 'sqlite3'
group :production do
gem 'thin'
end
group :test do
gem 'mocha'
gem 'simplecov'
gem 'webmock'
end
的database.yml
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test: &test
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000
更新..这是我的config / application.rb文件的顶部。而不是要求'all'(就像我的其他rails应用程序那样),它只需要几个选定的文件...
require File.expand_path('../boot', __FILE__)
require 'action_controller/railtie'
require 'rails/test_unit/railtie'
require 'sprockets/railtie'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
module SignInWithTwitter
答案 0 :(得分:1)
您从config/application.rb
require 'active_record/railtie'
这将在您的Rails应用程序启动时加载ActiveRecord,为它提供生成器所需的ORM功能。
如果你不想使用ActiveRecord,那么你应该研究一下DataMapper,甚至是类似Mongoid的东西,如果NoSQL数据库漂浮在你的船上。