scriptster
scriptster copied to clipboard
Rails console commands
Hello, nice gem you guys created.
I'm trying to access rails console and run some commands but I don't have success.
console = Scriptster::cmd("rails console")
Scriptster::cmd("Apartment::Tenant.create('local')")
Scriptster::cmd("quit")```
Could guys help me?
Thanks.
Hi @davithss,
Sorry if this is too late to be helpful, but it sounds like you'd be better off with a Rake task to carry out the ActiveRecord commands. Check out this guide to see how you can add them to your Rails app.
You could then call that rake task from Scriptster with Scriptster::cmd("./bin/rake my_task"), or, if you're using Rails 5: Scriptster::cmd("./bin/rails my_task").
Mostly adding this for posterity.