Added Puma
This commit is contained in:
parent
a8b1cc5ca7
commit
edfb099308
1
Gemfile
1
Gemfile
|
@ -47,3 +47,4 @@ end
|
|||
|
||||
# Use debugger
|
||||
# gem 'debugger', group: [:development, :test]
|
||||
gem 'puma'
|
||||
|
|
|
@ -87,6 +87,8 @@ GEM
|
|||
optionable (0.2.0)
|
||||
origin (2.0.0)
|
||||
polyglot (0.3.3)
|
||||
puma (2.7.1)
|
||||
rack (>= 1.1, < 2.0)
|
||||
rack (1.5.2)
|
||||
rack-test (0.6.2)
|
||||
rack (>= 1.0)
|
||||
|
@ -150,6 +152,7 @@ DEPENDENCIES
|
|||
jquery-rails
|
||||
mongoid!
|
||||
mongoid_slug!
|
||||
puma
|
||||
rails (= 4.0.2)
|
||||
sass-rails (~> 4.0.0)
|
||||
sdoc
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
class TemplatesController < ApplicationController
|
||||
before_action :set_template, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /templates
|
||||
# GET /templates.json
|
||||
def index
|
||||
@templates = Template.all
|
||||
end
|
||||
|
||||
# GET /templates/1
|
||||
# GET /templates/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /templates/new
|
||||
def new
|
||||
@template = Template.new
|
||||
end
|
||||
|
||||
# GET /templates/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /templates
|
||||
# POST /templates.json
|
||||
def create
|
||||
@template = Template.new(template_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @template.save
|
||||
format.html { redirect_to @template, notice: 'Template was successfully created.' }
|
||||
format.json { render action: 'show', status: :created, location: @template }
|
||||
else
|
||||
format.html { render action: 'new' }
|
||||
format.json { render json: @template.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /templates/1
|
||||
# PATCH/PUT /templates/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @template.update(template_params)
|
||||
format.html { redirect_to @template, notice: 'Template was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
format.html { render action: 'edit' }
|
||||
format.json { render json: @template.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /templates/1
|
||||
# DELETE /templates/1.json
|
||||
def destroy
|
||||
@template.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to templates_url }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_template
|
||||
@template = Template.find(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def template_params
|
||||
params.require(:template).permit(:title, :author)
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue