I've created a file ebm.rb
script to add new entries to a database in rails.
The file is very long, and uses some rails models.
Can I easily execute ebm.rb
in the rails console
?
I tried something with load
and require
, but that didn't work. My ebm.rb
file is located in C:\\Sites\\ebm
and my rails project in C:\\Sites\\rublesql
.
You can run the code in the file in the context of your rails app with
rails runner
http://guides.rubyonrails.org/command_line.html#rails-runner
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.