Class: Kommandant::CommandsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Kommandant::CommandsController
- Defined in:
- app/controllers/kommandant/commands_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/kommandant/commands_controller.rb', line 15 def create @command = Kommandant::Command.new(command_params_with_translations) if @command.save redirect_to commands_path, notice: "Command was successfully created." else render :new end end |
#destroy ⇒ Object
44 45 46 47 48 |
# File 'app/controllers/kommandant/commands_controller.rb', line 44 def destroy @command.destroy redirect_to commands_path, notice: "Command was successfully destroyed." end |
#edit ⇒ Object
33 34 |
# File 'app/controllers/kommandant/commands_controller.rb', line 33 def edit end |
#index ⇒ Object
7 8 9 |
# File 'app/controllers/kommandant/commands_controller.rb', line 7 def index @commands = Kommandant::Command.all end |
#new ⇒ Object
11 12 13 |
# File 'app/controllers/kommandant/commands_controller.rb', line 11 def new @command = Kommandant::Command.new end |
#show ⇒ Object
25 26 27 28 29 30 31 |
# File 'app/controllers/kommandant/commands_controller.rb', line 25 def show if Kommandant.config.recent_commands.enabled current_user.recent_commands.prepend(@command.id) end render :show, layout: false end |
#update ⇒ Object
36 37 38 39 40 41 42 |
# File 'app/controllers/kommandant/commands_controller.rb', line 36 def update if @command.update(command_params_with_translations) redirect_to commands_path, notice: "Command was successfully updated." else render :edit end end |