Skip to content

Instantly share code, notes, and snippets.

@bitsapien
Created May 30, 2016 08:31
Show Gist options
  • Save bitsapien/489ce829a6ae0aba830a2fffa4c80d1d to your computer and use it in GitHub Desktop.
Save bitsapien/489ce829a6ae0aba830a2fffa4c80d1d to your computer and use it in GitHub Desktop.
# app/models/concerns/states.rb
module States
extend ActiveSupport::Concern
included do
enum state: [ :in_process, :processing, :processed, :failed_processing, :verified ,:deleted, :invalid_file, :sent_to_api ]
end
end
# app/models/input_tracker.rb
class InputTracker < ApplicationRecord
has_one :output_tracker
include States
end
# app/models/output_tracker.rb
class OutputTracker < ApplicationRecord
belongs_to :input_tracker
include States
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment