Class: RoomsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- RoomsController
- Defined in:
- lib/generators/sbmeet/templates/controllers/rooms_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/generators/sbmeet/templates/controllers/rooms_controller.rb', line 13 def create @room = Room.new(room_params) if @room.save redirect_to @room else render :index, status: :unprocessable_entity end end |
#destroy ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/generators/sbmeet/templates/controllers/rooms_controller.rb', line 22 def destroy if current_user @room = Room.find(params[:id]) @room.destroy redirect_to rooms_path, notice: "Room deleted successfully." else redirect_to rooms_path, alert: "You do not have permission to delete this room." end end |
#index ⇒ Object
3 4 5 6 |
# File 'lib/generators/sbmeet/templates/controllers/rooms_controller.rb', line 3 def index @rooms = Room.all @room = Room.new end |
#show ⇒ Object
8 9 10 11 |
# File 'lib/generators/sbmeet/templates/controllers/rooms_controller.rb', line 8 def show @room = Room.find(params[:id]) @active_users = [@current_user] end |