0

I had after_save callback in my Rails app

after_save :foo
def foo
  return unless saved_change_to_bar?
  [some workflow action]
end

I want to know if there is some function to check if the save action was did it in console in order to do something like this.

after_save :foo
def foo
  return unless saved_change_to_bar? || action_performed_in_console?
  [some workflow action]
end

Thanks

Alex
  • 1
  • 1
  • Does this answer your question? https://stackoverflow.com/questions/13506690/how-to-determine-if-rails-is-running-from-cli-console-or-as-server – Casper Apr 13 '21 at 20:09
  • @Casper thanks I use `defined?(Rails::Console).present?` – Alex Apr 13 '21 at 20:16

0 Answers0