Class: LesliLetter::NotesController
- Inherits:
-
ApplicationController
- Object
- Lesli::ApplicationLesliController
- ApplicationController
- LesliLetter::NotesController
- Defined in:
- app/controllers/lesli_letter/notes_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /notes.
-
#destroy ⇒ Object
DELETE /notes/1.
-
#edit ⇒ Object
GET /notes/1/edit.
-
#index ⇒ Object
GET /notes.
-
#new ⇒ Object
GET /notes/new.
-
#show ⇒ Object
GET /notes/1.
-
#update ⇒ Object
PATCH/PUT /notes/1.
Instance Method Details
#create ⇒ Object
POST /notes
69 70 71 72 73 74 75 76 77 |
# File 'app/controllers/lesli_letter/notes_controller.rb', line 69 def create @note = Note.new(note_params) if @note.save redirect_to @note, notice: "Note was successfully created." else render :new, status: :unprocessable_entity end end |
#destroy ⇒ Object
DELETE /notes/1
92 93 94 95 |
# File 'app/controllers/lesli_letter/notes_controller.rb', line 92 def destroy @note.destroy redirect_to notes_url, notice: "Note was successfully destroyed.", status: :see_other end |
#edit ⇒ Object
GET /notes/1/edit
65 66 |
# File 'app/controllers/lesli_letter/notes_controller.rb', line 65 def edit end |
#index ⇒ Object
GET /notes
38 39 40 41 42 43 44 45 |
# File 'app/controllers/lesli_letter/notes_controller.rb', line 38 def index respond_to do |format| format.html {} format.json { respond_with_pagination(NoteService.new(current_user, query).index()) } end end |
#new ⇒ Object
GET /notes/new
60 61 62 |
# File 'app/controllers/lesli_letter/notes_controller.rb', line 60 def new @note = Note.new end |
#show ⇒ Object
GET /notes/1
48 49 50 51 52 53 54 55 56 57 |
# File 'app/controllers/lesli_letter/notes_controller.rb', line 48 def show respond_to do |format| format.html {} format.json { pp "--------" respond_with_successful(@note.show()) pp "--------" } end end |
#update ⇒ Object
PATCH/PUT /notes/1
80 81 82 83 84 85 86 87 88 89 |
# File 'app/controllers/lesli_letter/notes_controller.rb', line 80 def update @note.update(note_params) if @note.successful? return respond_with_successful(@note) end respond_with_error(@note.errors) end |