标签:style blog color cti html for
class Foo < ActiveRecord::Base unloadable validates_presence_of :subject validates_length_of :subject,:maximum => 255 end
def create @foo =Foo.new(params[:foo]) @foo.project_id =@project.id if @foo.save flash[:notice] = l(:notice_successful_create) if params[:continue] redirect_to :action=>‘new‘ else redirect_to :action=>‘show‘,:id=>@foo.id end else respond_to do |format| format.html { render :action => ‘new‘ } format.api { render_validation_errors(@foo) } end end end
rails [error_messages_for],布布扣,bubuko.com
标签:style blog color cti html for
原文地址:http://www.cnblogs.com/yuzhengdong/p/3813500.html