app/controllers/activities_controller.rb
def edit
    begin
      @activity = Activity.find(params[:id])
      @projects = Project.find(:all)
    rescue
      flash[:notice] = "No such activity"
      redirect_to :action => :index
    else
      @selected = {'project_id' => ''}
      if (@activity.project)
	@selected['project_id']=@activity.project.id.to_i
      end
    end
  end
# Fills form with details of activities to update

Fills form with details of activities to update
Fills form with details of activities to update
def edit
    begin
      @activity = Activity.find(params[:id])
      @projects = Project.find(:all)
    rescue
      flash[:notice] = "No such activity"
      redirect_to :action => :index
    else
      @selected = {'project_id' => ''}
      if (@activity.project)
	@selected['project_id']=@activity.project.id.to_i
      end
    end
  end
def edit begin @activity = Activity . find ( params [ :id ] ) @projects = Project . find ( :all ) rescue flash [ :notice ] = "No such activity" redirect_to :action => :index else @selected = { 'project_id' => '' } if ( @activity . project ) @selected [ 'project_id' ] = @activity . project . id . to_i end end end
Fills form with details of activities to update
Fills form with details of activities to update