class JamRuby::User attr_accessible :admin, :raw_password, :musician, :can_invite, :photo_url, :session_settings, :confirm_url, :teacher_attributes, :email_template, :is_platform_instructor # :invite_email accepts_nested_attributes_for :teacher, allow_destroy: true ransacker :jamuser_full_name, formatter: proc { |v| v.mb_chars.downcase.to_s } do |parent| Arel::Nodes::NamedFunction.new('LOWER', [Arel::Nodes::NamedFunction.new('concat_ws', [Arel::Nodes::SqlLiteral.new("' '"), User.arel_table[:first_name], User.arel_table[:last_name]])]) end def raw_password '' end def raw_password= pw unless pw.blank? # change_password(pw, pw) self.updating_password = true self.password = pw self.password_confirmation = pw if au = self.admin_user au.update_attribute(:encrypted_password, self.password_digest) end end end def admin_user User.where(:email => self.email)[0] end def show_frame_options self.get_gear_mod(MOD_GEAR_FRAME_OPTIONS) end def how_to_use_video_no_show self.get_no_show_mod(HOWTO_USE_VIDEO_NOSHOW) end def configure_video_no_show self.get_no_show_mod(CONFIGURE_VIDEO_NOSHOW) end end