Guest User

Untitled

a guest
Jun 23rd, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. # POST /jobs
  2. # POST /jobs.xml
  3. def create
  4. #ADD THIS LINE
  5. @catergory= Catergory.find(params[:catergory_id])#This is the new line added
  6. #It stores the value retrieved from the select box which displays the available categories to be added
  7. #END ADD
  8.  
  9. @job = Catergory.jobs.build(params[:job])
  10.  
  11. respond_to do |format|
  12. if @job.save
  13. format.html { redirect_to(@job, :notice => 'Job was successfully created.') }
  14. format.xml { render :xml => @job, :status => :created, :location => @job }
  15. else
  16. format.html { render :action => "new" }
  17. format.xml { render :xml => @job.errors, :status => :unprocessable_entity }
  18. end
  19. end
  20. end
Add Comment
Please, Sign In to add comment