免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3075 | 回复: 2
打印 上一主题 下一主题

rails总结 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-12-01 14:58 |只看该作者 |倒序浏览
rails总结










1 大家一起来写歌,歌曲创作共享.哼歌返回五线谱
2 index方法
3 images/下的jpg等文件,link的相对路径直接写文件名即可,

TODO:
=======
module和class区别,什么场合用module?
局部变量,实例变量和符号(:)区别?
puts Symbol.all_symbols可以看见symbol表中的所有symbol

创建数据库表,例如创建sessions表
rake db:sessions:create
rake db:migrate

建立sessions表具有特殊意义,代表session信息。
如果建立products表

常用命令:
===========
rails
========
1. 创建项目
rails new my_app

2. 建立一个person框架,包括person数据表,controller, view, test,models
rails g scaffold person name:string bio:text birth:date

3 启动服务器
rails server

=====
rake --tasks 查看所有命令
=====
  1. rake about              # List versions of all Rails frameworks and the env...
  2. rake assets:clean       # Remove compiled assets
  3. rake assets:precompile  # Compile all the assets named in config.assets.pre...
  4. rake db:create          # Create the database from config/database.yml for ...
  5. rake db:drop            # Drops the database for the current Rails.env (use...
  6. rake db:fixtures:load   # Load fixtures into the current environment's data...
  7. rake db:migrate         # Migrate the database (options: VERSION=x, VERBOSE...
  8. rake db:migrate:status  # Display status of migrations
  9. rake db:rollback        # Rolls the schema back to the previous version (sp...
  10. rake db:schema:dump     # Create a db/schema.rb file that can be portably u...
  11. rake db:schema:load     # Load a schema.rb file into the database
  12. rake db:seed            # Load the seed data from db/seeds.rb
  13. rake db:setup           # Create the database, load the schema, and initial...
  14. rake db:structure:dump  # Dump the database structure to an SQL file
  15. rake db:version         # Retrieves the current schema version number
  16. rake doc:app            # Generate docs for the app -- also available doc:r...
  17. rake log:clear          # Truncates all *.log files in log/ to zero bytes
  18. rake middleware         # Prints out your Rack middleware stack
  19. rake notes              # Enumerate all annotations (use notes:optimize, :f...
  20. rake notes:custom       # Enumerate a custom annotation, specify with ANNOT...
  21. rake rails:template     # Applies the template supplied by LOCATION=(/path/...
  22. rake rails:update       # Update configs and some other initially generated...
  23. rake routes             # Print out all defined routes in match order, with...
  24. rake secret             # Generate a cryptographically secure secret key (t...
  25. rake stats              # Report code statistics (KLOCs, etc) from the appl...
  26. rake test               # Runs test:units, test:functionals, test:integrati...
  27. rake test:recent        # Run tests for {:recent=>"test:prepare"} / Test re...
  28. rake test:single        # Run tests for {:single=>"test:prepare"}
  29. rake test:uncommitted   # Run tests for {:uncommitted=>"test:prepare"} / Te...
  30. rake time:zones:all     # Displays all time zones, also available: time:zon...
  31. rake tmp:clear          # Clear session, cache, and socket files from tmp/ ...
  32. rake tmp:create         # Creates tmp directories for sessions, cache, sock...
复制代码

论坛徽章:
0
2 [报告]
发表于 2011-12-21 22:18 |只看该作者
学习鸟  谢谢

论坛徽章:
0
3 [报告]
发表于 2011-12-22 10:04 |只看该作者
挺不错。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP