scriptster icon indicating copy to clipboard operation
scriptster copied to clipboard

Rails console commands

Open davithss opened this issue 9 years ago • 1 comments

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.

davithss avatar Oct 26 '16 17:10 davithss

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.

spikeheap avatar Jan 10 '17 11:01 spikeheap