How can i cancel the effect of a command-generate controller in my app

Hello what command can i sue to get rid of the effect of the below command

ruby script/generate scaffold \ user name:string hashed_password:string salt:string

Regards and Respects,

Kindness in thought leads to wisdom. Kindness in speech leads to eloquence. Kindness in action leads to love.

Oluwayomi, you can do the following:

ruby script/generate user name:string hash_password:string salt:string

Note: The above code will generate a model called User.

Good luck,

-Conrad

Hello what command can i sue to get rid of the effect of the below command

ruby script/generate scaffold \ user name:string hashed_password:string salt:string

Regards and Respects,

Oluwayomi, you can do the following:

ruby script/generate user name:string hash_password:string salt:string

ruby script/generate model user name:string hash_password:string salt:string

Look at the list of files that were generated and remove them :slight_smile: (You'll also need to edit routes.rb)

And for the future -- if you were using a versioning system like git, you could create a branch when you were adding a model, and if it didn't suit you afterwards, you could just delete the branch. FWIW!

Are you asking about how to reverse this? There is a destroy script available with the rails install:

yvaine:reverseblade rilindo$ ruby script/destroy

Usage: script/destroy generator [options] [args]

Rails Info:

-v, --version Show the Rails version number and quit.

-h, --help Show this help message and quit.

General Options:

-p, --pretend Run but do not make any changes.

-f, --force Overwrite files that already exist.

-s, --skip Skip files that already exist.

-q, --quiet Suppress normal output.

-t, --backtrace Debugging: show backtrace on errors.

-c, --svn Modify files with subversion. (Note: svn must be in path)

-g, --git Modify files with git. (Note: git must be in path)

Installed Generators

Builtin: controller, helper, integration_test, mailer, metal, migration, model, observer, performance_test, plugin, resource, scaffold, session_migration

script/generate command. For instance, ‘script/destroy migration CreatePost’

will delete the appropriate XXX_create_post.rb migration file in db/migrate,

while ‘script/destroy scaffold Post’ will delete the posts controller and

views, post model and migration, all associated tests, and the map.resources

:posts line in config/routes.rb.

For instructions on finding new generators, run script/generate.

yvaine:reverseblade rilindo$

Same options as generate, except it cleans out your generated files.

what do i edit in route.rb? thanks Regards and Respects, Kindness in thought leads to wisdom. Kindness in speech leads to eloquence. Kindness in action leads to love.

Oluwayomi Oluwadara wrote:

what do i edit in route.rb? thanks

Whatever your version control system says was changed.

If you're not using version control, download Git and start *today*. There is no excuse for working without version control.

Best,

Well, I totally forgot about script/destroy which Rilindo mentioned, so that's certainly an easier route.

However, if you need/want to do it manually, just look for a reference to the model you created; it'll be pretty obvious.

And really, use git for revision control and get in the habit of frequent commits; it'll be such a time-saver when you can just

  prompt$ git diff config/routes.rb

to find the changes...

FWIW,

thanks Regards and Respects, Kindness in thought leads to wisdom. Kindness in speech leads to eloquence. Kindness in action leads to love.

thanks Regards and Respects, Kindness in thought leads to wisdom. Kindness in speech leads to eloquence. Kindness in action leads to love.

And you can then use commands like

git checkout some/file/that/changed

to revert individual files to the state before the generate

or

git reset

To reset the entire working directory to the state of the last commit.