Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我有 2 个模型,用户和组
user belongs_to :group group has_many :users
有没有办法在组被销毁之前/之后将 user.group 属性设置为另一个值?
class Group < ActiveRecord::Base has_many :users before_destroy -> { users.each {|u| u.group = nil; u.save}} end
In order to fix an IE9 bug I had to put the 'DOCTYPE' declaration at the top of the page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&