Class: Tim::TemplatesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Tim::TemplatesController
- Defined in:
- app/controllers/tim/templates_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
24 25 26 27 28 29 30 |
# File 'app/controllers/tim/templates_controller.rb', line 24 def create @template = Tim::Template.new(params[:template]) unless defined? @template if @template.save flash[:notice] = 'Template was successfully created.' end respond_with(@template, @respond_options) end |
#destroy ⇒ Object
40 41 42 43 44 |
# File 'app/controllers/tim/templates_controller.rb', line 40 def destroy @template = Tim::Template.find(params[:id]) unless defined? @template @template.destroy respond_with(@template, @respond_options) end |
#edit ⇒ Object
19 20 21 22 |
# File 'app/controllers/tim/templates_controller.rb', line 19 def edit @template = Tim::Template.find(params[:id]) respond_with(@template, @respond_options) end |
#index ⇒ Object
4 5 6 7 |
# File 'app/controllers/tim/templates_controller.rb', line 4 def index @templates = Tim::Template.all unless defined? @templates respond_with(@templates, @respond_options) end |
#new ⇒ Object
14 15 16 17 |
# File 'app/controllers/tim/templates_controller.rb', line 14 def new @template = Tim::Template.new unless defined? @template respond_with(@template, @respond_options) end |
#show ⇒ Object
9 10 11 12 |
# File 'app/controllers/tim/templates_controller.rb', line 9 def show @template = Tim::Template.find(params[:id]) unless defined? @template respond_with(@template, @respond_options) end |
#update ⇒ Object
32 33 34 35 36 37 38 |
# File 'app/controllers/tim/templates_controller.rb', line 32 def update @template = Tim::Template.find(params[:id]) unless defined? @template if @template.update_attributes(params[:template]) flash[:notice] = 'Template was successfully updated.' end respond_with(@template, @respond_options) end |