Class: LesliLetter::NotebooksController
- Inherits:
-
ApplicationController
- Object
- Lesli::ApplicationLesliController
- ApplicationController
- LesliLetter::NotebooksController
- Defined in:
- app/controllers/lesli_letter/notebooks_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /notebooks.
-
#destroy ⇒ Object
DELETE /notebooks/1.
-
#edit ⇒ Object
GET /notebooks/1/edit.
-
#index ⇒ Object
GET /notebooks.
-
#new ⇒ Object
GET /notebooks/new.
-
#show ⇒ Object
GET /notebooks/1.
-
#update ⇒ Object
PATCH/PUT /notebooks/1.
Instance Method Details
#create ⇒ Object
POST /notebooks
61 62 63 64 65 66 67 68 69 |
# File 'app/controllers/lesli_letter/notebooks_controller.rb', line 61 def create @notebook = Notebook.new(notebook_params) if @notebook.save redirect_to @notebook, notice: "Notebook was successfully created." else render :new, status: :unprocessable_entity end end |
#destroy ⇒ Object
DELETE /notebooks/1
81 82 83 84 |
# File 'app/controllers/lesli_letter/notebooks_controller.rb', line 81 def destroy @notebook.destroy redirect_to notebooks_url, notice: "Notebook was successfully destroyed.", status: :see_other end |
#edit ⇒ Object
GET /notebooks/1/edit
57 58 |
# File 'app/controllers/lesli_letter/notebooks_controller.rb', line 57 def edit end |
#index ⇒ Object
GET /notebooks
38 39 40 41 42 43 44 45 |
# File 'app/controllers/lesli_letter/notebooks_controller.rb', line 38 def index respond_to do |format| format.html {} format.json { respond_with_pagination(NotebookService.new(current_user, query).index()) } end end |
#new ⇒ Object
GET /notebooks/new
52 53 54 |
# File 'app/controllers/lesli_letter/notebooks_controller.rb', line 52 def new @notebook = Notebook.new end |
#show ⇒ Object
GET /notebooks/1
48 49 |
# File 'app/controllers/lesli_letter/notebooks_controller.rb', line 48 def show end |
#update ⇒ Object
PATCH/PUT /notebooks/1
72 73 74 75 76 77 78 |
# File 'app/controllers/lesli_letter/notebooks_controller.rb', line 72 def update if @notebook.update(notebook_params) redirect_to @notebook, notice: "Notebook was successfully updated.", status: :see_other else render :edit, status: :unprocessable_entity end end |