我试图运行简单的迁移,但是我收到了这个错误。我认为这是一种兼容性错误。我该如何解决它,如何在将来避免兼容性问题?
Migration: `class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :nume
t.string :email
t.string :localitate
t.timestamps
end
end
end
___________________
的Gemfile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0.beta4'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0.0.beta1'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jQuery as the JavaScript library
gem 'jquery-rails', '~> 4.0.0.beta2'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0.0.beta4'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :jruby]
___________
错误:
错误的参数数量(1表示0)C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0
0.0 /宝石/了activerecord-4.2.0.beta4 / LIB / active_record / connection_adapters / abstract_
adapter.rb:271:initialize'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b/active_record/connection_adapters/abstract_adapter.rb:271:in
新&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b / active_record / connection_adapters / abstract_adapter.rb:271:在substitute_at'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b/active_record/relation.rb:97:in
块中的substitute_values&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b / active_record / relation.rb:96:在each'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b/active_record/relation.rb:96:in
each_with_index&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b / active_record / relation.rb:96:in substitute_values'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b/active_record/relation.rb:56:in
insert&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b / active_record / persistence.rb:521:在_create_record'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b/active_record/counter_cache.rb:139:in
_ create_record&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b / active_record / attribute_methods / dirty.rb:122:在_create_record中的_create_record'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b/active_record/callbacks.rb:306:in
块中&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0.beta4/l
ib / active_support / callbacks.rb:88:in call'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0.beta4/l
ib/active_support/callbacks.rb:88:in
_ run_callbacks&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0.beta4/l
ib / active_support / callbacks.rb:734:在_run_create_callbacks'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b/active_record/callbacks.rb:306:in
_ create_record&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b / active_record / timestamp.rb:57:在_create_record'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b/active_record/persistence.rb:501:in
create_or_update&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b / active_record / callbacks.rb:302:block in create_or_update'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0.beta4/l
ib/active_support/callbacks.rb:88:in
来电&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0.beta4/l
ib / active_support / callbacks.rb:88:in _run_callbacks'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0.beta4/l
ib/active_support/callbacks.rb:734:in
_ run_save_callbacks&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b / active_record / callbacks.rb:302:在create_or_update'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b/active_record/persistence.rb:142:in
保存!&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b / active_record / validations.rb:42:in save!'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b/active_record/attribute_methods/dirty.rb:29:in
保存!&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b / active_record / transactions.rb:289:在with_transaction_returning_stat的block in save!'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b/active_record/transactions.rb:345:in
块中
我们&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b / active_record / connection_adapters / abstract / database_statements.rb:211:在tran
saction'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b/active_record/transactions.rb:218:in
交易&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b / active_record / transactions.rb:342:在with_transaction_returning_status'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b/active_record/transactions.rb:289:in
保存!&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b / active_record / persistence.rb:51:in create!'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b/active_record/migration.rb:1015:in
record_version_state_after_migrating&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b / active_record / migration.rb:985:在ddl_transaction&#39;中的block in execute_migration_in_transaction'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b/active_record/migration.rb:1030:in
块中
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b / active_record / connection_adapters / abstract / database_statements.rb:213:in bloc
k in transaction'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b/active_record/connection_adapters/abstract/transaction.rb:188:in
within_new_t
ransaction&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b / active_record / connection_adapters / abstract / database_statements.rb:213:在tran
saction'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b/active_record/transactions.rb:218:in
交易&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b / active_record / migration.rb:1030:在ddl_transaction'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b/active_record/migration.rb:983:in
execute_migration_in_transaction&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b / active_record / migration.rb:945:block in migrate'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b/active_record/migration.rb:941:in
每个&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b / active_record / migration.rb:941:在migrate'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b/active_record/migration.rb:813:in
向上&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b / active_record / migration.rb:791:在migrate'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b/active_record/tasks/database_tasks.rb:137:in
中迁移&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta4/li
b / active_record / railties / databases.rake:44:在block (2 levels) in <top (require
d)>'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.4.0/lib/rake/task.r
b:240:in
来电&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.4.0/lib/rake/task.r
b:240:block in execute'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.4.0/lib/rake/task.r
b:235:in
每个&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.4.0/lib/rake/task.r
b:235:在execute'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.4.0/lib/rake/task.r
b:179:in
块中的invoke_with_call_chain&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/monitor.rb:211:在mon_synchronize'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.4.0/lib/rake/task.r
b:172:in
invoke_with_call_chain&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.4.0/lib/rake/task.r
b:165:在invoke'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.4.0/lib/rake/applic
ation.rb:156:in
invoke_task&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.4.0/lib/rake/applic
ation.rb:112:block (2 levels) in top_level'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.4.0/lib/rake/applic
ation.rb:112:in
每个&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.4.0/lib/rake/applic
ation.rb:112:在block in top_level'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.4.0/lib/rake/applic
ation.rb:121:in
run_with_threads&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.4.0/lib/rake/applic
ation.rb:106:在top_level'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.4.0/lib/rake/applic
ation.rb:84:in
块中运行&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.4.0/lib/rake/applic
ation.rb:182:在standard_exception_handling'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.4.0/lib/rake/applic
ation.rb:79:in
运行&#39;
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.4.0/bin/rake:33:在
<top (required)>'
C:/RailsInstaller/Ruby2.0.0/bin/rake:23:in
负载&#39;
C:/RailsInstaller/Ruby2.0.0/bin/rake:23:在`&#39;
任务:TOP =&gt;分贝:迁移
答案 0 :(得分:1)
答案在这里:Can't migrate database after scaffold. Section 2.2 Ruby on Rails Tutorial Michael Hartl
您需要安装那里指定的arel gem。