Sha256: 4791dc53d7d98e5df2cab5882d2ccbd481d3dfb87f0511f9f76ca89036421e76

Contents?: true

Size: 450 Bytes

Versions: 1

Compression:

Stored size: 450 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_confirmation if password_changed?
      self.reader.save! if self.reader.changed?
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
radiant-reader-extension-3.0.9 lib/reader_user.rb