0
Ich verwende Rails 4.2.3. Ich habe diese Migration geschaffen, die für mich automatisch generiert wurde von Rails ...Die automatisch generierte Rails-Migration verursacht einen "Syntaxfehler, unerwartet ' n" "Fehler
class CreateDistanceUnits < ActiveRecord::Migration
def change
create_table :distance_units do |t|
t.string, :description
t.string :abbrev
t.timestamps null: false
end
add_index :distance_units, [:abbrev], :unique => true
end
end
aber wenn ich es laufen, bekomme ich diese bizarren Fehler
davea$ rake db:migrate
rake aborted!
SyntaxError: /Users/davea/Documents/workspace/runtrax/db/migrate/20160629210722_create_distance_units.rb:4: syntax error, unexpected '\n', expecting &. or :: or '[' or '.'
/Users/davea/.rvm/gems/[email protected]/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:244:in `rescue in load_dependency'
/Users/davea/.rvm/gems/[email protected]/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:237:in `load_dependency'
/Users/davea/.rvm/gems/[email protected]/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `require'
/Users/davea/.rvm/gems/[email protected]/gems/activerecord-4.2.5.1/lib/active_record/migration.rb:777:in `load_migration'
/Users/davea/.rvm/gems/[email protected]/gems/activerecord-4.2.5.1/lib/active_record/migration.rb:773:in `migration'
/Users/davea/.rvm/gems/[email protected]/gems/activerecord-4.2.5.1/lib/active_record/migration.rb:768:in `disable_ddl_transaction'
/Users/davea/.rvm/gems/[email protected]/gems/activerecord-4.2.5.1/lib/active_record/migration.rb:1051:in `use_transaction?'
/Users/davea/.rvm/gems/[email protected]/gems/activerecord-4.2.5.1/lib/active_record/migration.rb:1043:in `ddl_transaction'
/Users/davea/.rvm/gems/[email protected]/gems/activerecord-4.2.5.1/lib/active_record/migration.rb:997:in `execute_migration_in_transaction'
/Users/davea/.rvm/gems/[email protected]/gems/activerecord-4.2.5.1/lib/active_record/migration.rb:959:in `block in migrate'
/Users/davea/.rvm/gems/[email protected]/gems/activerecord-4.2.5.1/lib/active_record/migration.rb:955:in `each'
/Users/davea/.rvm/gems/[email protected]/gems/activerecord-4.2.5.1/lib/active_record/migration.rb:955:in `migrate'
/Users/davea/.rvm/gems/[email protected]/gems/activerecord-4.2.5.1/lib/active_record/migration.rb:823:in `up'
/Users/davea/.rvm/gems/[email protected]/gems/activerecord-4.2.5.1/lib/active_record/migration.rb:801:in `migrate'
/Users/davea/.rvm/gems/[email protected]/gems/activerecord-4.2.5.1/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/Users/davea/.rvm/gems/[email protected]/gems/activerecord-4.2.5.1/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/Users/davea/.rvm/gems/ruby-2.3.0/gems/rake-11.2.2/exe/rake:27:in `<top (required)>'
/Users/davea/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
/Users/davea/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
Was es über beschwert? Ich benutze eine PostGres-Datenbank. Danke, - Dave