- 浏览: 255320 次
- 性别:
- 来自: 苏州
文章分类
最新评论
-
px_dn:
谢谢!!
ubuntu server替换更新源 -
clark1231:
boiaprogramfan0420 写道求教一个问题 oc ...
像hackers一样写博客(三):幫你的Octopress增加文章分類 -
boiaprogramfan0420:
求教一个问题 octopress的read on功能怎么实现 ...
像hackers一样写博客(三):幫你的Octopress增加文章分類 -
leorn:
帮我解决问题了,谢谢
rails post方式提交表单,session丢失的解决办法 -
clark1231:
微博分享那个功能,我就给了个看到的链接,那个又不是我写的。我写 ...
像hackers一样写博客(二):Octopress设置与增加微博的侧边栏
rails
1.new and server
With just three commands we whipped up a Rails server listening on port 3000
rails new commandsapp
cd commandsapp
rails server(rails s)
rails server -e production -p 4000
rails server –help
2.generate
rails generate controller NAME [action action] [options]
eg: rails generate controller Say hello goodbye
rails generate model NAME [field:type field:type] [options]
eg: rails generate model post title:string body:text published:boolean
rails generate scaffold HighScore user:references game:string score:integer
rails generate migration add_quantity_to_production quantity:integer
the common data definition tasks detail
add_column
add_index
change_column
change_table
create_table
drop_table
remove_column
remove_index
rename_column
3.other
rails console(rails c)
rails dbconsole(rails db)
rails plugin
rails runner(rails r)
eg: rails runner "Model.long_running_method"
rails destroy(rails d)
eg: rails generate model Oops
rails destroy model Oops
Rake
rake --tasks(rake -T) #show a list of Rake tasks
1.about
rake about #About your application's environment
2.assets
rake assets:clean # Remove compiled assets
rake assets:precompile # Compile all the assets named in config.assets.precompile
3.db
rake db:create # Create the database from config/database.yml for the current Rails.env
rake db:create:all # Create all dbs
rake db:drop # Drops the database for the current Rails.env (use db:drop:all to drop all databases)
rake db:fixtures:load # Load fixtures into the current environment's database.
rake db:migrate # Migrate the database (options: VERSION=x, VERBOSE=false).
rake db:migrate:status # Display status of migrations
rake db:migrate:down version=..........
rake db:migrate redo
rake db:perf:all # recreate table and test data
rake db:perf:perf # populate test data
rake db:perf:prepare # recreate table structure for populating data
rake db:populate # recreate table and test data
rake db:populate:all # recreate table and test data
rake db:populate:populate # populate test data
rake db:populate:prepare # recreate table structure for populating data
rake db:rollback # Rolls the schema back to the previous version (specify steps w/ STEP=n) eg:rake db:rollback STEP=3.
rake db:schema:dump # Create a db/schema.rb file that can be portably used against any DB supported by AR
rake db:schema:load # Load a schema.rb file into the database
rake db:seed # Load the seed data from db/seeds.rb
rake db:setup # Create the database, load the schema, and initialize with the seed data
rake db:reset
rake db:structure:dump # Dump the database structure to db/structure.sql. Specify another file with DB_STRUCTURE=db/my_structure.sql
rake db:version # Retrieves the current schema version number
4.routes
rake routes # list all of your defined routes
5.tmp
rake tmp:cache:clear # clears tmp/cache.
rake tmp:sessions:clear # clears tmp/sessions.
rake tmp:sockets:clear # clears tmp/sockets.
rake tmp:clear # clears all the three: cache, sessions and sockets.
6.spec
rake spec # Run all specs in spec directory (excluding plugin specs)
rake spec:controllers # Run the code examples in spec/controllers
rake spec:helpers # Run the code examples in spec/helpers
rake spec:lib # Run the code examples in spec/lib
rake spec:mailers # Run the code examples in spec/mailers
rake spec:models # Run the code examples in spec/models
rake spec:rcov # Run all specs with rcov
rake spec:requests # Run the code examples in spec/requests
rake spec:routing # Run the code examples in spec/routing
rake spec:views # Run the code examples in spec/views
7.log
rake log:clear # Truncates all *.log files in log/ to zero bytes
8.stats
rake stats # show the detail of code(lines,classes,methods...)
gem
gem -v # gem版本
gem update # 更新所有包
gem update --system # 更新RubyGems软件
gem install rake # 安装rake,从本地或远程服务器
gem install rake --remote # 安装rake,从远程服务器
gem install watir -v(或者--version) 1.6.2 # 指定安装版本的
gem uninstall rake # 卸载rake包
gem list # 列出所有安装的gem
gem list d # 列出本地以d打头的包
gem query -n '[0-9]' --local # 查找本地含有数字的包
gem search log --both # 从本地和远程服务器上查找含有log字符串的包
gem search log --remoter # 只从远程服务器上查找含有log字符串的包
gem search -r log # 只从远程服务器上查找含有log字符串的包
gem help # 提醒式的帮助
gem help install # 列出install命令 帮助
gem help examples # 列出gem命令使用一些例子
gem build rake.gemspec # 把rake.gemspec编译成rake.gem
gem check -v pkg/rake-0.4.0.gem # 检测rake是否有效
gem cleanup # 清除所有包旧版本,保留最新版本
gem contents rake # 显示rake包中所包含的文件
gem dependency rails -v 0.10.1 # 列出与rails相互依赖的包
gem environment # 查看gem的环境
gem list | cut -d" " -f1 | xargs gem uninstall -aIx # 删除所有安装的gem
你可以去我另一个blog上看,这里没有重新调整格式:http://caok.github.com/blog/2012/05/13/a-guide-to-the-rails-command-line/
发表评论
-
Rails Cookies与Session操作汇总
2014-07-07 12:17 1210Rails 操作 session 和 cookies 非常 ... -
rspec in rails
2013-05-04 16:33 1322原文在我另外一个博客上,地址:http://caok12 ... -
Factory Girl中的关系定义
2013-05-04 16:25 1143原文在我另外一个博客上,地址:http://ca ... -
Deploy Rails App With Cloud Foundry
2013-03-27 09:25 1190原文在我另外一个博客上,地址:http://caok1231 ... -
Deploy Rails App With Mina
2013-03-27 09:06 1371原文请见我另外一个博客:http://caok1231.co ... -
rails中的时间显示格式【转】
2013-02-26 12:21 2155在rails中需要显示时间时,格式化时间的方法一般选 ... -
在rails中如何加载自定义方法
2013-02-24 20:52 0require File.join(Rails.root, ... -
Caching With Rails
2013-02-18 16:55 1093原文在我另一个博客上,这边就不在另外排版了,可参见http ... -
VMC的使用
2013-01-16 13:04 19311.安装ruby环境 rvm install 1.9.3 ... -
send mail in rails
2012-10-22 14:48 1141Creating and Sending Mail 1. ... -
Rails中获取url信息
2012-09-06 14:40 1412Rails中获取url信息的一些方法 如本机我测试域名 ... -
production环境下css和js文件未加载
2012-08-25 10:01 1123production环境下css和js文件编译过,路径之类的都 ... -
The Use of Google-Maps-for-Rails
2012-08-22 09:16 917http://caok.github.com/blog/201 ... -
Rails with massive data
2012-08-22 07:43 939http://blog.xdite.net/posts/201 ... -
jQuery columnManager Plugin and Rails-settings-cached
2012-08-07 20:26 1368原文参见我另一个博客:http://caok.github.c ... -
validates_numericality_of
2012-07-09 11:09 1337在针对float类型的字段quantity进行如下数量限制时 ... -
滚动公告功能的实现
2012-06-26 19:44 12991.新建一个表 create_table "n ... -
Ruby更改gem source
2012-06-13 10:54 2642很多时候,在安装gem的过程中会出现找不到资源的erro ... -
Rails 3.0.7 - before_filter returns false, but action executed
2012-05-04 08:08 1132Test Case Description: Crea ... -
Auto-Complete Association
2012-05-03 15:35 1212针对有些情况下下拉菜单过长导致选择不便,此处我将演示通过输入文 ...
相关推荐
综上所述,《Ruby on Rails Guides_ A Guide to Testing Rails Applications.pdf》是一个全面的资源,无论你是Rails新手还是资深开发者,都能从中学习到如何为Rails应用编写高质量的测试。从理论到实践,从单元测试...
标题:"A Guide to Testing the Rails.pdf" 描述:"A Guide to Testing the Rails" 此份文档旨在深入探讨Ruby on Rails框架下的测试策略,为开发者提供一份详尽的测试指南。文档涵盖了从理论基础到实际应用的全...
The more confident reader might be able to get started in Rails using just this book, extensive online resources, and his wits, but there are other publications that are more introductory in nature ...
The Rails™ 3 Way is the only comprehensive, authoritative guide to delivering production-quality code with Rails 3. Pioneering Rails expert Obie Fernandez and a team of leading experts illuminate ...
Ruby on Rails Guides_ A Guide to Active Record Associations.pdf
### 关于《The Rails 4 Way》的知识点总结 #### 标题:The Rails 4 Way 这本书主要讲述了Ruby on Rails 4版本的核心特性和最佳实践。Ruby on Rails(简称Rails)是一个用Ruby语言编写的开源全栈Web应用框架。本书...
《The Rails Way》一书由Obie Fernandez撰写,属于Addison-Wesley Professional Ruby系列,该系列致力于为读者提供实用、面向人且深入的信息,帮助他们利用Ruby平台创建动态技术解决方案。这一系列书籍的创立基于一...
You'll learn to build Rails applications, connect to databases, perform necessary testing, and put the whole thing together to create real-world applications such as shopping carts and online ...
You concentrate on creating the application, and Rails takes care of the details., Tens of thousands of developers have used this award-winning book to learn Rails. It’s a broad, far-reaching ...
Test the component parts of a Rails application, including the back-end model logic and the front-end display logic. With Rails examples, use testing to enable your code to respond better to future ...
Book Details Publisher: Addison-Wesley Professional By: Obie Fernandez ISBN-10: 0321944275 ISBN-13: 978-0321944276 Year: June 8, 2014 Pages: 912 Language: English File size: 4 MB ...
### 关于《The Rails 4 Way》的知识点总结 #### 书籍概述 《The Rails 4 Way》是一本深入探讨Ruby on Rails 4框架特性的专业书籍,由Obie Fernandez、Kevin Faustino和Vitaly Kushner共同撰写。本书旨在为开发者...