Class: LesliShield::SessionsController
- Inherits:
-
ApplicationController
- Object
- Lesli::ApplicationLesliController
- ApplicationController
- LesliShield::SessionsController
- Defined in:
- app/controllers/lesli_shield/sessions_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /sessions.
-
#destroy ⇒ Object
DELETE /sessions/1.
-
#edit ⇒ Object
GET /sessions/1/edit.
-
#index ⇒ Object
GET /sessions.
-
#new ⇒ Object
GET /sessions/new.
-
#show ⇒ Object
GET /sessions/1.
-
#update ⇒ Object
PATCH/PUT /sessions/1.
Instance Method Details
#create ⇒ Object
POST /sessions
31 32 33 34 35 36 37 38 39 |
# File 'app/controllers/lesli_shield/sessions_controller.rb', line 31 def create @session = Session.new(session_params) if @session.save redirect_to @session, notice: "Session was successfully created." else render :new, status: :unprocessable_entity end end |
#destroy ⇒ Object
DELETE /sessions/1
51 52 53 54 |
# File 'app/controllers/lesli_shield/sessions_controller.rb', line 51 def destroy @session.destroy! redirect_to sessions_path, notice: "Session was successfully destroyed.", status: :see_other end |
#edit ⇒ Object
GET /sessions/1/edit
27 28 |
# File 'app/controllers/lesli_shield/sessions_controller.rb', line 27 def edit end |
#index ⇒ Object
GET /sessions
6 7 8 9 10 11 12 13 14 15 |
# File 'app/controllers/lesli_shield/sessions_controller.rb', line 6 def index respond_to do |format| format.html { @sessions = respond_as_pagination(Lesli::User::SessionService.new(current_user, query).index()) } format.json { respond_with_pagination(UserSessionService.new(current_user, query).index()) } end end |
#new ⇒ Object
GET /sessions/new
22 23 24 |
# File 'app/controllers/lesli_shield/sessions_controller.rb', line 22 def new @session = Session.new end |
#show ⇒ Object
GET /sessions/1
18 19 |
# File 'app/controllers/lesli_shield/sessions_controller.rb', line 18 def show end |
#update ⇒ Object
PATCH/PUT /sessions/1
42 43 44 45 46 47 48 |
# File 'app/controllers/lesli_shield/sessions_controller.rb', line 42 def update if @session.update(session_params) redirect_to @session, notice: "Session was successfully updated.", status: :see_other else render :edit, status: :unprocessable_entity end end |