Skip to content

Commit

Permalink
Add endpoint for creating Jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
zacstewart committed Mar 17, 2014
1 parent 4665ff2 commit 055164b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions app/controllers/jobs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,16 @@ class JobsController < ApplicationController
def index
respond_with Job.all
end

def create
@job = Job.create(job_params)

respond_with @job, status: :created
end

private

def job_params
params.require(:job).permit(:title, :description)
end
end
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
devise_for :users, skip: :all

defaults format: :json do
resources :jobs, only: [:index]
resources :jobs, only: [:index, :create, :show]
end

defaults format: :html do
Expand Down

0 comments on commit 055164b

Please sign in to comment.