全部文本 #35320 原始 编辑

RaydenUni

公开 ruby v1 · 不可变
·已发布 2005-12-30 21:33 UTC
渲染后的文本正文
  def create    test_passed = 1 #will be set to 0 if it ever fails a test        @flat_page = FlatPage.new(params[:flat_page])    if @flat_page.save        flash[:notice] = 'FlatPage was successfully created.'    else        test_passed = 0    end        @org_relation = OrgRelation.new(params[:org_relation])    if @org_relation.save        flash[:notice] = 'org_relation was successfully created.'    else        test_passed = 0    end        @org = Org.new(:content_type_id => 1,                     :content_id => @flat_page.id,                    :page_title => @org.page_title,  #THIS is what i want to do, but obviously @org doesn't exist yet                    :is_menu_item => 0)    if @org.save        flash[:notice] = 'org was successfully created.'    else        test_passed = 0    end        if test_passed = 1        redirect_to :action => 'list'    else      render :action => 'new'    end  end