app/controllers/contract_controller.rb
# Saves a contract record. The order of update is significant...
# pay attention to this when adding new values to save with the 
# contract 
Saves a contract record. The order of update is significant
pay attention to this when adding new values to save with the
contract
Saves a contract record . The order of update is significant pay attention to this when adding new values to save with the contract
def update_contract(contract)
		contract.term = Term.find(params[:contract][:term_id]) if params[:contract] && params[:contract][:term_id]
		if params[:activate] && params[:activate] == '1'
		  contract.contract_status = Contract::STATUS_ACTIVE
		end
		if params[:contract] && params[:contract][:facilitator_id]
		  contract.facilitator = User.find(params[:contract][:facilitator_id])
		else
		  contract.facilitator = @user.privilege >= User::PRIVILEGE_STAFF ? @user : User.unassigned
		end
		if params[:saved_timeslot]
  		contract.timeslots = []
  		params[:saved_timeslot].each do |k,v|
  			contract.timeslots << eval(v)
  		end
    end
    if params[:ealr]
      contract.ealrs.clear
      contract.ealrs << Ealr.find(:all, :conditions => ["id in (?)", params[:ealr].values.collect{|e| e.to_i}])
    end
		return contract.update_attributes(params[:contract])
	end
def update_contract ( contract ) contract . term = Term . find ( params [ :contract ] [ :term_id ] ) if params [ :contract ] && params [ :contract ] [ :term_id ] if params [ :activate ] && params [ :activate ] == '1' contract . contract_status = Contract :: STATUS_ACTIVE end if params [ :contract ] && params [ :contract ] [ :facilitator_id ] contract . facilitator = User . find ( params [ :contract ] [ :facilitator_id ] ) else contract . facilitator = @user . privilege >= User :: PRIVILEGE_STAFF ? @user : User . unassigned end if params [ :saved_timeslot ] contract . timeslots = [ ] params [ :saved_timeslot ] . each do | k , v | contract . timeslots << eval ( v ) end end if params [ :ealr ] contract . ealrs . clear contract . ealrs << Ealr . find ( :all , :conditions => [ "id in (?)" , params [ :ealr ] . values . collect { | e | e . to_i } ] ) end return contract . update_attributes ( params [ :contract ] ) end
Saves a contract record.
Saves a contract record .
## SECOND we store the form parameters
contract
<not_specific>