简体   繁体   中英

forgetting the : on a command line while installing devise

So I was supposed to type this "rails generate devise:install" in the terminal. instead I typed "rails generate devise install". Does it make a difference? What should I do to repair it if there is something wrong.

I hope I'm not wasting anyone's time with a stupid question; however I've spent the better part of the past 4 months being thwarted by semi-colons that should have been colons, devastated by missing commas and heart-broken by single spelling errors. I've gotten into the habit of thinking every letter and character counts.

Thanks!

Yes, there's a difference. When you run rails generate devise install you're telling Devise to configure devise for model called install because here's config syntax from Devise's README:

In the following command you will replace MODEL with the class name used for the application's users (it's frequently User but could also be Admin). This will create a model (if one does not exist) and configure it with the default Devise modules. The generator also configures your config/routes.rb file to point to the Devise controller.

$ rails generate devise MODEL

To undo the changes just run rails destroy devise install and run it properly (with colon) after.

In general programs which get called from the command line parse arguments by spaces. Rails generators are programs which generate code for your project. They take command line arguments. Let's see how this works in your case:

rails generate #takes the name of generator as its 1st argument
rails generate devise #tells generate to lookup the devise namespace

# the next single argument `devise:install` is parsed by generator and 
# calls the install task. The colon is use by [Rake][1] to call tasks within namespace
rails generate devise:install

# As already mentioned in previous answer and in devise docs
# here install is not a sub task but an argument passed to the devise task
rails generate devise user # this is typically the model devise would use

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM