All pastes #35320 Raw Edit

RaydenUni

public ruby v1 · immutable
#35320 ·published 2005-12-30 21:33 UTC
rendered paste body
  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