rails-generate

Does rails scaffold command support generate belongs_to or many to many model middle table migration info?

眉间皱痕 提交于 2020-01-04 12:04:52
问题 Product,Category is two model on rails3 the relation between them are follow: product has_and_belongs_to_many categories category has_and_belongs_to_many products i can use scaffold generate migration for this two modle use rails g scaffold product name:string rails g scaffold category name:string but how can i generate the many to many model's middle table migration info,or i need write it manually,if so this is hard for me,hope someone could help me. 回答1: You need create this table by

Does rails scaffold command support generate belongs_to or many to many model middle table migration info?

寵の児 提交于 2020-01-04 11:56:00
问题 Product,Category is two model on rails3 the relation between them are follow: product has_and_belongs_to_many categories category has_and_belongs_to_many products i can use scaffold generate migration for this two modle use rails g scaffold product name:string rails g scaffold category name:string but how can i generate the many to many model's middle table migration info,or i need write it manually,if so this is hard for me,hope someone could help me. 回答1: You need create this table by

Missing script/generate in Rails 3

风流意气都作罢 提交于 2019-11-30 11:07:12
I just installed Rails 3 and created my first app. The install of Rails3 + ruby 1.9 went very smoothly but I am missing the generate script in script/generate. I have created a new app from scratch with no options to verify. Any idea why this is happening and how to fix it? all script/* commands has been removed from rails 3. You should use rails generate or rails g instead of script/generate , rails server or rails s instead of script/server and so on. try rails generate ... the only script existing now is rails all others will be called as parameter of rails. Take a look a the Ruby on Rails

Missing script/generate in Rails 3

*爱你&永不变心* 提交于 2019-11-29 16:36:04
问题 I just installed Rails 3 and created my first app. The install of Rails3 + ruby 1.9 went very smoothly but I am missing the generate script in script/generate. I have created a new app from scratch with no options to verify. Any idea why this is happening and how to fix it? 回答1: all script/* commands has been removed from rails 3. You should use rails generate or rails g instead of script/generate , rails server or rails s instead of script/server and so on. 回答2: try rails generate ... the

How do I reverse a 'rails generate'?

你离开我真会死。 提交于 2019-11-27 09:55:53
i.e. delete all the files it created and roll back any changes made? Not necessarily to the db, but more to the config files. E.g. automatically deleting all the resource mappings for the model/controller deleted in the routes.rb file and everywhere else that changes might have been made? Thanks. rails destroy controller lalala rails destroy model yadayada rails destroy scaffold hohoho Rails 3.2 adds a new d shortcut to the command, so now you can write: rails d controller lalala rails d model yadayada rails d scaffold hohoho It's worth mentioning the -p flag here (p for pretend). If you add

How do I reverse a 'rails generate'?

老子叫甜甜 提交于 2019-11-26 14:57:29
问题 i.e. delete all the files it created and roll back any changes made? Not necessarily to the db, but more to the config files. E.g. automatically deleting all the resource mappings for the model/controller deleted in the routes.rb file and everywhere else that changes might have been made? Thanks. 回答1: rails destroy controller lalala rails destroy model yadayada rails destroy scaffold hohoho Rails 3.2 adds a new d shortcut to the command, so now you can write: rails d controller lalala rails d