我的控制器中有以下内容:
def create
group = Group.create(params[:group])
end
这在我的模型中:
validate :governance_style_change, :on => :update
. . . .
private
def governance_style_change
if self.governance_style_was != 3
errors.add(:governance_style, I18n.t("group.errors.cannot_change_governance_style"))
end
end
出于某种原因,验证在create
期间运行。我做错了什么?