Class: LesliLetter::NotebooksController

Inherits:
ApplicationController show all
Defined in:
app/controllers/lesli_letter/notebooks_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

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

#destroyObject

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

#editObject

GET /notebooks/1/edit



57
58
# File 'app/controllers/lesli_letter/notebooks_controller.rb', line 57

def edit
end

#indexObject

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

#newObject

GET /notebooks/new



52
53
54
# File 'app/controllers/lesli_letter/notebooks_controller.rb', line 52

def new
    @notebook = Notebook.new
end

#showObject

GET /notebooks/1



48
49
# File 'app/controllers/lesli_letter/notebooks_controller.rb', line 48

def show
end

#updateObject

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