Sha256: 4f7fdce349bb78c4bb49e17353f030955c363522f46765cd2b26009a23225fc8

Contents?: true

Size: 671 Bytes

Versions: 6

Compression:

Stored size: 671 Bytes

Contents

module ExportFile
  def self.included(base)
    base.extend ClassMethods
  end

  module ClassMethods
    def enju_export_file_model
      include InstanceMethods
      belongs_to :user
      validates :user, presence: true
      attr_accessor :mode
    end
  end

  module InstanceMethods
    def send_message
      sender = User.find(1) #system
      message_template = MessageTemplate.localized_template('export_completed', user.profile.locale)
      request = MessageRequest.new
      request.assign_attributes({sender: sender, receiver: user, message_template: message_template})
      request.save_message_body
      request.transition_to!(:sent)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
enju_leaf-1.1.0 lib/enju_leaf/export_file.rb
enju_leaf-1.1.0.rc22 lib/enju_leaf/export_file.rb
enju_leaf-1.1.0.rc21 lib/enju_leaf/export_file.rb
enju_leaf-1.1.0.rc20 lib/enju_leaf/export_file.rb
enju_leaf-1.1.0.rc19 lib/enju_leaf/export_file.rb
enju_leaf-1.1.0.rc18 lib/enju_leaf/export_file.rb