Sha256: 5f789848a35e73430698fe2fe487200cc2eb23f519335882c38d8a7fa1d8003a

Contents?: true

Size: 437 Bytes

Versions: 2

Compression:

Stored size: 437 Bytes

Contents

module ReaderUser

  def self.included(base)
    base.class_eval do
      has_one :reader
      before_update :update_reader
    end
  end
  
  def update_reader
    if self.reader
      Reader.user_columns.each { |att| self.reader.send("#{att.to_s}=", send(att)) if send("#{att.to_s}_changed?") }
      self.reader.password_confirmation = password if password_changed?
      self.reader.save! if self.reader.changed?
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
radiant-reader-extension-3.0.11 lib/reader_user.rb
radiant-reader-extension-3.0.10 lib/reader_user.rb