Skip to content

Instantly share code, notes, and snippets.

@safarista
Created September 29, 2010 15:48
Show Gist options
  • Save safarista/602992 to your computer and use it in GitHub Desktop.
Save safarista/602992 to your computer and use it in GitHub Desktop.
# POST /jobs
# POST /jobs.xml
def create
#ADD THIS LINE
@catergory= Catergory.find(params[:catergory_id])#This is the new line added
#It stores the value retrieved from the select box which displays the available categories to be added
#END ADD
@job = Catergory.jobs.build(params[:job])
respond_to do |format|
if @job.save
format.html { redirect_to(@job, :notice => 'Job was successfully created.') }
format.xml { render :xml => @job, :status => :created, :location => @job }
else
format.html { render :action => "new" }
format.xml { render :xml => @job.errors, :status => :unprocessable_entity }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment