rails总结
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 查看所有命令
=====rake about # List versions of all Rails frameworks and the env...
rake assets:clean # Remove compiled assets
rake assets:precompile# Compile all the assets named in config.assets.pre...
rake db:create # Create the database from config/database.yml for ...
rake db:drop # Drops the database for the current Rails.env (use...
rake db:fixtures:load # Load fixtures into the current environment's data...
rake db:migrate # Migrate the database (options: VERSION=x, VERBOSE...
rake db:migrate:status# Display status of migrations
rake db:rollback # Rolls the schema back to the previous version (sp...
rake db:schema:dump # Create a db/schema.rb file that can be portably u...
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 initial...
rake db:structure:dump# Dump the database structure to an SQL file
rake db:version # Retrieves the current schema version number
rake doc:app # Generate docs for the app -- also available doc:r...
rake log:clear # Truncates all *.log files in log/ to zero bytes
rake middleware # Prints out your Rack middleware stack
rake notes # Enumerate all annotations (use notes:optimize, :f...
rake notes:custom # Enumerate a custom annotation, specify with ANNOT...
rake rails:template # Applies the template supplied by LOCATION=(/path/...
rake rails:update # Update configs and some other initially generated...
rake routes # Print out all defined routes in match order, with...
rake secret # Generate a cryptographically secure secret key (t...
rake stats # Report code statistics (KLOCs, etc) from the appl...
rake test # Runs test:units, test:functionals, test:integrati...
rake test:recent # Run tests for {:recent=>"test:prepare"} / Test re...
rake test:single # Run tests for {:single=>"test:prepare"}
rake test:uncommitted # Run tests for {:uncommitted=>"test:prepare"} / Te...
rake time:zones:all # Displays all time zones, also available: time:zon...
rake tmp:clear # Clear session, cache, and socket files from tmp/ ...
rake tmp:create # Creates tmp directories for sessions, cache, sock... 学习鸟谢谢 挺不错。
页:
[1]