I'm new to ROR.
How can I use the same App name after I delete my rails App?
Following are the actions I performed. Step #6 is my problem.
1 - Environment
- OS : Ubuntu 12.04.4
- ruby : 2.1.1p76
- rails : 4.1.2
- DB : SQLite
2 - Create rails App :
rails new myApp
=> OK
3 - Create model :
rails generate model mytable name:string
=> OK.
4 - Delete rails App :
rm -rf myApp
=> OK
5 - Re-Create rails App :
rails new myApp
=> OK
6 - Re-Create model :
rails generate model mytable name:string
=> Not OK! waiting for infinite time
Just a hunch, but by any chance, are you still running a server process somewhere on your machine? That could be holding a lock that is preventing the new table from getting built.
Follow below steps
1 - Create rails App :
rails new myApp
2 - Create model :
rails generate model mytable name:string
3 - Drop The database :
rake db:drop
4 - Delete rails App :
rm -rf myApp
5 - Re-Create rails App :
rails new myApp
6 - Recreate Database
rake db:create
7 - Re-Create model :
rails generate model mytable name:string
I think your database still has the table corresponding to your model from the first time you created it. What database system are you using? Performing rm -rf
does not generally affect the database since the data lives outside the Rails app directory. You may need to reset the database with
$ rake db:reset
This will delete the table that was left over from the first time you created the model.
Note: If you are using SQLite for your database, this may point to a different problem.
不要杀死弹簧,只需使用内置的spring stop
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.