Index: 用于检索所有条目 Show&Destory: 1.根据id检索相应的条目 2.跳转到show.html.erb 提供相应 respond_to: 特定怎么去相应一个request redirect_to: New&Create: Create Action 没有模板,它会试着将obje Read More
posted @ 2019-04-16 10:19 vixennn Views(157) Comments(0) Diggs(0)
什么是Action Pack: Rest and Rails: Rest if all about resources rake routes: print out all routes Read More
posted @ 2019-04-15 16:47 vixennn Views(87) Comments(0) Diggs(0)
Active Record Scope: default_scope: 默认的检索方式 Scope 总是返回ActiveRecord::Relation Validations: 数据总是要经过Validations才能存在数据库之中 Writing your own validation: N+1 Read More
posted @ 2019-04-14 22:14 vixennn Views(144) Comments(0) Diggs(0)
One-to-One Association: *一个person只对应一个personal_info *一个personal_info只属于一个person *belongs to用foreign key来链接 此外你同时也有2个method 用于person的实例 你需要用 has_one/be Read More
posted @ 2019-04-13 21:00 vixennn Views(101) Comments(0) Diggs(0)
Seeding the Database: db/seed.rb 可以提供预设data rake db:seed rails db .headers on .mode columns 显示数据库内容 Including SQL fragments: SQL injection: *操作原始SQL以侵 Read More
posted @ 2019-04-13 18:08 vixennn Views(123) Comments(0) Diggs(0)
Active Record: ORM ( Object-relational Mapping)Bridges the gap between relational databases , which are designed around mathematical Set Theory and Ob Read More
posted @ 2019-04-12 20:09 vixennn Views(159) Comments(0) Diggs(0)
ruby是动态语言,它有动态语言的优势与劣势 动态语言,像python与ruby 你不用提前去定义method - they need to only be "found" when invoked calling method dynamically: Dynamic Dispatch: 不需要c Read More
posted @ 2019-04-12 12:10 vixennn Views(182) Comments(0) Diggs(0)
自动生成的id 被当作primary key来使用 timestamp method生成 created_at 与 updated_at columns create_table 和 drop_table 用来生成表与删除表 null:false 表明不能为null rake db:rollback Read More
posted @ 2019-04-11 20:39 vixennn Views(209) Comments(0) Diggs(0)
*rails uses SQLite for database by default *Built-in command-line DB viewer *Self-contained,server-less,zero-configuration,transactional, relational S Read More
posted @ 2019-04-11 16:58 vixennn Views(101) Comments(0) Diggs(0)
Scaffolding能快速让rails跑起来 同时也生成JSON response rails g scaffolding "xxx" xxy:integer 生成scaffolding model&migration rake db:migrate 生成table Scffolding 生成 1 Read More
posted @ 2019-04-11 10:23 vixennn Views(120) Comments(0) Diggs(0)