Method: Effective::FlashMessages#action_verb
- Defined in:
- app/controllers/concerns/effective/flash_messages.rb
#action_verb(action) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'app/controllers/concerns/effective/flash_messages.rb', line 62 def action_verb(action) action = action.to_s.gsub('_', ' ') word = action.split(' ').first.to_s if word == 'destroy' 'deleted' elsif word == 'undo' 'undid' elsif word == 'run' 'ran' elsif word.end_with?('e') action.sub(word, word + 'd') elsif ['a', 'i', 'o', 'u'].include?(word[-1]) action else action.sub(word, word + 'ed') end end |