Module: Kommandant::RecentCommands
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/controllers/concerns/kommandant/recent_commands.rb
Instance Method Summary collapse
Instance Method Details
#set_recent_commands ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/concerns/kommandant/recent_commands.rb', line 8 def set_recent_commands return unless current_user.present? if current_user.recent_commands.elements.any? @recent_commands ||= current_user.recent_commands.elements.map do |command_id| Kommandant::Command.find(command_id) end else Kommandant::Command.all.each do |command| current_user.recent_commands << command.id end end end |