Class: Stachio::TemplatesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Stachio::TemplatesController
- Defined in:
- app/controllers/stachio/templates_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /templates POST /templates.json.
-
#destroy ⇒ Object
DELETE /templates/1 DELETE /templates/1.json.
-
#edit ⇒ Object
GET /templates/1/edit.
-
#index ⇒ Object
GET /templates GET /templates.json.
-
#new ⇒ Object
GET /templates/new GET /templates/new.json.
-
#show ⇒ Object
GET /templates/1 GET /templates/1.json.
-
#update ⇒ Object
PUT /templates/1 PUT /templates/1.json.
Instance Method Details
#create ⇒ Object
POST /templates POST /templates.json
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/controllers/stachio/templates_controller.rb', line 49 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 json: @template, status: :created, location: @template } else format.html { render action: "new" } format.json { render json: @template.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /templates/1 DELETE /templates/1.json
81 82 83 84 85 86 87 88 89 |
# File 'app/controllers/stachio/templates_controller.rb', line 81 def destroy @template = Template.find(params[:id]) @template.destroy respond_to do |format| format.html { redirect_to templates_url } format.json { head :no_content } end end |
#edit ⇒ Object
GET /templates/1/edit
43 44 45 |
# File 'app/controllers/stachio/templates_controller.rb', line 43 def edit @template = Template.find(params[:id]) end |
#index ⇒ Object
GET /templates GET /templates.json
11 12 13 14 15 16 17 18 |
# File 'app/controllers/stachio/templates_controller.rb', line 11 def index @templates = Template.all respond_to do |format| format.html # index.html.erb format.json { render json: @templates } end end |
#new ⇒ Object
GET /templates/new GET /templates/new.json
33 34 35 36 37 38 39 40 |
# File 'app/controllers/stachio/templates_controller.rb', line 33 def new @template = Template.new respond_to do |format| format.html # new.html.erb format.json { render json: @template } end end |
#show ⇒ Object
GET /templates/1 GET /templates/1.json
22 23 24 25 26 27 28 29 |
# File 'app/controllers/stachio/templates_controller.rb', line 22 def show @template = Template.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @template } end end |
#update ⇒ Object
PUT /templates/1 PUT /templates/1.json
65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'app/controllers/stachio/templates_controller.rb', line 65 def update @template = Template.find(params[:id]) respond_to do |format| if @template.update_attributes(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 |