- 浏览: 247532 次
- 性别:
- 来自: 苏州
文章分类
最新评论
-
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 1159Rails 操作 session 和 cookies 非常 ... -
rspec in rails
2013-05-04 16:33 1272原文在我另外一个博客上,地址:http://caok12 ... -
Factory Girl中的关系定义
2013-05-04 16:25 1098原文在我另外一个博客上,地址:http://ca ... -
Deploy Rails App With Cloud Foundry
2013-03-27 09:25 1145原文在我另外一个博客上,地址:http://caok1231 ... -
Deploy Rails App With Mina
2013-03-27 09:06 1317原文请见我另外一个博客:http://caok1231.co ... -
rails中的时间显示格式【转】
2013-02-26 12:21 2111在rails中需要显示时间时,格式化时间的方法一般选 ... -
在rails中如何加载自定义方法
2013-02-24 20:52 0require File.join(Rails.root, ... -
Caching With Rails
2013-02-18 16:55 1047原文在我另一个博客上,这边就不在另外排版了,可参见http ... -
VMC的使用
2013-01-16 13:04 18891.安装ruby环境 rvm install 1.9.3 ... -
send mail in rails
2012-10-22 14:48 1103Creating and Sending Mail 1. ... -
Rails中获取url信息
2012-09-06 14:40 1363Rails中获取url信息的一些方法 如本机我测试域名 ... -
production环境下css和js文件未加载
2012-08-25 10:01 1085production环境下css和js文件编译过,路径之类的都 ... -
The Use of Google-Maps-for-Rails
2012-08-22 09:16 858http://caok.github.com/blog/201 ... -
Rails with massive data
2012-08-22 07:43 904http://blog.xdite.net/posts/201 ... -
jQuery columnManager Plugin and Rails-settings-cached
2012-08-07 20:26 1319原文参见我另一个博客:http://caok.github.c ... -
validates_numericality_of
2012-07-09 11:09 1299在针对float类型的字段quantity进行如下数量限制时 ... -
滚动公告功能的实现
2012-06-26 19:44 12511.新建一个表 create_table "n ... -
Ruby更改gem source
2012-06-13 10:54 2571很多时候,在安装gem的过程中会出现找不到资源的erro ... -
Rails 3.0.7 - before_filter returns false, but action executed
2012-05-04 08:08 1098Test Case Description: Crea ... -
Auto-Complete Association
2012-05-03 15:35 1158针对有些情况下下拉菜单过长导致选择不便,此处我将演示通过输入文 ...
相关推荐
A Guide to Testing the Rails
Ruby on Rails Guides_ A Guide to Testing Rails Applications.pdf
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 ...
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
This book will guide you in creating a Rails application. It will focus on setting your system up properly and will fly a little lower than the typical 50,000 foot level of many tutorials. While Rails...
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 ...
Summary 94 Chapter 6: Creating Navigation Bars 95 Getting started with a navigation bar 95 Navigation bar helper classes 102 Adding a navigation bar to the Rails application 103 Summary 105 Chapter 7:...
If you’re a web developer or designer ready to learn Ruby on Rails, this hands-on guide is the ideal way to get started. Rather than toss you into the middle of the framework’s Model-View-Controller...
a serious competitor to the social networking heavyweights, RailsSpace is not a toy; it’s designed to show how to use Rails to make a web application suitable for deployment into a production ...
学习ruby!
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 ...
The Rails way 最新版本 The Rails way 最新版本 The Rails way 最新版本
rails 2.0 english version
For a .NET developer, learning Rails is as much about the cultural and philosophical shifts in thinking as it is about the technical learning curve. In this book, we hope to break down some of these ...
The rails4 way, 英文原版
Rails 4 in Action is a hands-on guide to the subject. In this fully revised new edition, you'll master Rails 4 by developing a ticket-tracking application that includes RESTful routing, authentication...
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 ...
Ruby on Rails框架是Ruby的一个杀手级应用框架,可以敏捷开发Web应用,是目前为止开发效率最高的Web开发技术