payment_settup/app/models/payment_pay.rb

21 lines
465 B
Ruby

class PaymentPay
include Mongoid::Document
include Mongoid::Timestamps
field :amount
field :module_name
field :module_item_id
field :member_profile
attr_accessor :user
before_create do
if self.member_profile.nil?
self.member_profile = self.user.member_profile
end
end
def member_profile
MemberProfile.find(self['member_profile']) rescue nil
end
def member_profile= (member)
self['member_profile'] = member.id
end
end