I am trying to move different parts of a model into concerns. Two of each are the states defined by AASM, and attachments with Paperclip.
So, I am moving the related codes into separate files.
app/models/concerns/user_aasm.rb
class User
module UserAasm
extend ActiveSupport::Concern
included do
include AASM
aasm do
state :unverified, initial: true
state :approved
state :suspended
state :deleted
state :banned
end
end
end
end
and in my user.rb, I do
include UserAasm
I got the following error:
Unable to autoload constant UserAasm, expected app/models/concerns/user_aasm.rb to define it
I wonder what I got wrong in the code.. How to use it in a correct way?