Useful Rails3 Commands – Cheatsheet

Some of useful Rails3 Commands and their descriptions are listed below:

rails new ApplicationName – Create a new application
rails new ApplicationName -d mysql  - Create a new application use MySQL
rails generate/g model ModelName – Creates a model with the specified model_name
rails generate/g controller ControllerName – Creates a controller with the specified controller_name

rails generate/g migration MigrationName – Creates a migration with the specified migration_name
rails generate/g scaffold ModelName ControllerName – A shortcut for creating your controller, model and view files etc.
rails destroy controller ControllerName – Destroys the created controller and its related file. Same way you can destroy your model, migration files etc.
rails server/s – start ruby server at http://localhost:3000
rails plugin install PluginName – Installs the specified plugin.
rails console/c – Opens the rails console for the current RAILS_ENV
rails dbconsole/db – Opens the DB console for the current RAILS_ENV
rails performance – For benchmarkering and profiling your application.

rake –tasks – Lists all available rake tasks
rake db:create – Create the database defined in config/database.yml for the current RAILS_ENV
rake db:drop – Drops the database for the current RAILS_ENV
rake db:migrate – Migrate the database through scripts in db/migrate folder.
rake db:reset – Drops and recreates the database from db/schema.rb for the current environment.
rake db:rollback – This will run the down method from the latest migration.
rake db:schema:dump – Create a db/schema.rb file that can be portably used against any DB supported by AR
rake doc:app – Build the RDOC HTML Files
rake db:sessions:create – Creates a sessions migration for use with CGI::Session::ActiveRecordStore
rake gems – List the gems that this rails application depends on
rake gems:install – Installs all required gems for this application.
rake log:clear – Truncates all *.log files in log/ to zero bytes
rake rails:freeze:gems – Lock this application to the current gems (by unpacking them into vendor/rails)
rake routes – Print out all defined routes in match order, with names.
rake test – Run all unit, functional and integration tests
rake test:functionals – Run tests for functionalsdb:test:prepare / Run the functional tests in test/functional
rake test:integration – Run tests for integrationdb:test:prepare / Run the integration tests in test/integration
rake test:units – Run tests for unitsdb:test:prepare / Run the unit tests in test/unit
rake tmp:clear – Clear session, cache, and socket files from tmp/

gem list – Lists all the installed gems.
gem install GemName – Installs the specified gem in to your machine.
gem uninstall GemName – Uninstalls the specified gem from your machine.
gem server – present a web page at http://localhost:8808/ with info about installed gems.


原文地址:http://veerasundaravel.wordpress.com/2010/10/07/useful-rails3-commands-cheatsheet/



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值