How to script/destroy a model?

I love how easy it is to run a generator from RubyMine. However, it is never easy for me to undo it if needed. I always end up going out to the console to do it.

Is there an easy way to run the script/destroy process from within RubyMine?

NOTE: I'm using Ubuntu 9.10, RubyMine 2.0.1.

I have tried Tools > "Run Rails Script..." but I can't get this to work. I read  the RubyMine help and  follow the instructions but it still doesn't work.

Lets assume I have a model called Post. From the command-line I would enter "ruby script/destroy model Post"

Example 1:

  1. Tools > "Run Rails Script..."
  2. Script: destroy model Post
  3. Result: "Unable to execute Rails script. Script "destroy model Post" not found!"


Example 2:

  1. Tools > "Run Rails Script..."
  2. Script: destroy
  3. Result: Run Rails Script tab appears and the "destroy" scripts help on usage appears.


Is it broken or am I missing something? Is it planned to make running reverse generators easier?

Thanks,
-Mark E.

0
3 comments
Avatar
Permanently deleted user

Hello Mark,

You were pretty close to the correct variant.
Run Rails Script dialog has 2 fields: Script and Arguments. You should fill in both of them.
Screenshot.png

Regards,
Oleg

0
Avatar
Permanently deleted user

Ah.... thanks for the clarification! Now it looks obvious.

-Mark E.

0
Avatar
Permanently deleted user

This apparently does not work with Rails 3.X as script folder does not contain destroy script in project

How to execute rails commands then?

I found the way by selecting script/rails in the dialog and then typing

"destroy model bla-bla"

Why then bother with UI if it requires so much typing? May be easier just allow to start a console from command root inside IDE and allow to type

rails destroy model bla-bla

It looks more natural and will save time

0

Please sign in to leave a comment.