<commit_before># encoding: utf-8
module Freeberry
  module Models
    module User
      def self.included(base)
        base.send :include, InstanceMethods
        base.send :extend,  ClassMethods
      end
      
      module ClassMethods
        def self.extended(base)
          base.class_eval do
            before_validation :make_login
        
            has_many :roles, :dependent => :delete_all
            has_one :avatar, :as => :assetable, :dependent => :destroy
            
            scope :admins, joins(:roles).where(["`roles`.role_type = ?", ::RoleType.admin.id])
            scope :with_role, proc {|role| joins(:roles).where(["`roles`.role_type = ?", role.id]) }
          end
        end
      end
      
      module InstanceMethods
        def manager?
	        has_role?(:manager)
	      end
	
	      def admin?
	        has_role?(:admin)
	      end
	
	      def has_role?(role_name)<commit_msg>fix user avatar<commit_after># encoding: utf-8
module Freeberry
  module Models
    module User
      def self.included(base)
        base.send :include, InstanceMethods
        base.send :extend,  ClassMethods
      end
      
      module ClassMethods
        def self.extended(base)
          base.class_eval do
            before_validation :make_login
        
            has_many :roles, :dependent => :delete_all
            has_one :avatar, :as => :assetable, :dependent => :destroy, :autosave => true
            
            scope :admins, joins(:roles).where(["`roles`.role_type = ?", ::RoleType.admin.id])
            scope :with_role, proc {|role| joins(:roles).where(["`roles`.role_type = ?", role.id]) }
          end
        end
      end
      
      module InstanceMethods
        def manager?
	        has_role?(:manager)
	      end
	
	      def admin?
	        has_role?(:admin)
	      end
	
	      def has_role?(role_name)
{'fraction_non_alphanumeric': 0.10391001606855918, 'fraction_numerical': 0.0010712372790573112, 'mean_word_length': 1.856269113149847, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '638114', 'n_tokens_mistral': 569, 'n_tokens_neox': 540, 'n_words': 125}