- バックアップ一覧
- ソース を表示
- Ruby on Rails/第4回勉強会 - Active Record Reference Documentation は削除されています。
- 1 (2006-08-11 (金) 14:46:20)
- 2 (2006-08-11 (金) 16:44:44)
- 3 (2006-08-17 (木) 11:02:02)
- 4 (2006-08-24 (木) 17:44:36)
- 5 (2006-10-03 (火) 16:43:09)
Ruby on Rails/第4回勉強会 - Active Record Reference Documentation?
rails勉強会一覧 †
'rails' には、下位層のページがありません。
第4回勉強会のネタ †
ネタもとは下記です。
- RubyOnRails を使ってみる 【第 3 回】 ActiveRecord
http://jp.rubyist.net/magazine/?0006-RubyOnRails
- vendor/activerecord/README
原文: http://api.rubyonrails.org/files/vendor/rails/activerecord/README.html
邦訳: http://wiki.fdiary.net/rails/?ActiveRecord
- Active Record Reference Documentation
http://rubyonrails.org/api/classes/ActiveRecord/Base.html
日時 †
- 2006/08/11(金) 18:00くらい 〜
参加者 †
動画 †
動画は全部で3つです。
続きはrails/第4回勉強会 - Active Record Reference Documentation/動画?にあります。
htmlinsert: Specified localfile, ./study/rails4-1.html, does not exist. Specified wiki page, :HTML/study/rails4-1.html, does not exist.
生成 †
- ハッシュで。
user = User.new(:name => "David", :occupation => "Code Artist") user.name # => "David"
- blockで。
user = User.new do |u| u.name = "David" u.occupation = "Code Artist" end
- 空のオブジェクトをつくって。後から属性の設定。
user = User.new user.name = "David" user.occupation = "Code Artist"
追加または更新 †
- saveまたは、save!メソッドで。
http://rubyonrails.org/api/classes/ActiveRecord/Base.html#M000905- No record exists: Creates a new record with values matching those of the object attributes.
- A record does exist: Updates the record with values matching those of the object attributes.
- save!は
it raises a RecordNotSaved exception
検索 †
- findやfind_by_sql メソッドで。
http://rubyonrails.org/api/classes/ActiveRecord/Base.html#M000860
http://rubyonrails.org/api/classes/ActiveRecord/Base.html#M000861
削除 †
- delete
http://rubyonrails.org/api/classes/ActiveRecord/Base.html#M000865 - delete_all
- destory
all the callbacks are the triggered
- destory_all
updateを使った更新 †
- update
- update_all
- update_attribute