Class: Admin::DocumentsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- BaseController
- Admin::DocumentsController
- Defined in:
- app/controllers/admin/documents_controller.rb
Instance Method Summary collapse
Methods inherited from BaseController
Methods included from BaseHelper
Instance Method Details
#create ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'app/controllers/admin/documents_controller.rb', line 20 def create @document = Document.new(params[:document]) if @document.save redirect_to admin_documents_path else render :new end end |
#destroy ⇒ Object
42 43 44 45 46 |
# File 'app/controllers/admin/documents_controller.rb', line 42 def destroy @document = Document.find(params[:id]) @document.destroy redirect_to admin_documents_path end |
#edit ⇒ Object
29 30 31 |
# File 'app/controllers/admin/documents_controller.rb', line 29 def edit @document = Document.find(params[:id]) end |
#index ⇒ Object
11 12 13 14 |
# File 'app/controllers/admin/documents_controller.rb', line 11 def index @search = Document.search(params[:search]) @documents = @search.order(:title).page(params[:page]) end |
#new ⇒ Object
16 17 18 |
# File 'app/controllers/admin/documents_controller.rb', line 16 def new @document = Document.new end |
#update ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'app/controllers/admin/documents_controller.rb', line 33 def update @document = Document.find(params[:id]) if @document.update_attributes(params[:document]) redirect_to admin_documents_path else render :edit end end |