I tried to run an ruby script in rails with the command rails runner. The ruby file, looks something like this and should create new patients:
Patient.create!({:vorname => 'Josepha', :nachnahme => 'Brecht', :geburtsdatum => '25.04.1963', :strasse => 'Umdorf', :ort => 'W?rthss', :plz => '93093'})
Patient.create!({:vorname => 'Tumba', :nachnahme => 'Hoch', :geburtsdatum => '17.77.1956', :strasse => 'Hama? 1', :ort => 'Brenn', :plz => '93189'})
But somehow my code has problems with the german language! Im programming beginner and do not know what i have to change! Thanks for help!
C:Siteswhat>rails runner patienten.rb
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/c
ommands/runner.rb:51:in `eval': patienten.rb:2: invalid multibyte char (UTF-8) (
SyntaxError)
patienten.rb:2: syntax error, unexpected tIDENTIFIER, expecting '}'
...> 'Schlossberg', :ort => 'W?rth', :plz => '93086'})
... ^
patienten.rb:2: syntax error, unexpected tINTEGER, expecting $end
...:ort => 'W?rth', :plz => '93086'})
... ^
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1
3/lib/rails/commands/runner.rb:51:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1
3/lib/rails/commands.rb:64:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1
3/lib/rails/commands.rb:64:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…