<commit_before>module Resourceful
  module CanCanMethods
    extend ActiveSupport::Concern
    
    included do

      load_and_authorize_resource

      alias_method_chain :can_create?, :cancan
      alias_method_chain :can_update?, :cancan
      alias_method_chain :can_show?, :cancan
      alias_method_chain :can_destroy?, :cancan

    end
    
    def can_create_with_cancan?(item=nil)
      can_create_without_cancan? and can?(:create, item || resource)
    end
    
    def can_update_with_cancan?(item=nil)
      can_update_without_cancan? and can?(:update, item || resource)
    end
    
    def can_show_with_cancan?(item=nil)
      can_show_without_cancan? and can?(:read, item || resource)
    end
    
    def can_destroy_with_cancan?(item=nil)
      can_destroy_without_cancan? and can?(:destroy, item || resource)
    end

    
    
    
  end
end<commit_msg>cancan can_create tweawk<commit_after>module Resourceful
  module CanCanMethods
    extend ActiveSupport::Concern
    
    included do

      load_and_authorize_resource

      alias_method_chain :can_create?, :cancan
      alias_method_chain :can_update?, :cancan
      alias_method_chain :can_show?, :cancan
      alias_method_chain :can_destroy?, :cancan

    end
    
    def can_create_with_cancan?(item=nil)
      can_create_without_cancan? and can?(:create, self.resource_class)
    end
    
    def can_update_with_cancan?(item=nil)
      can_update_without_cancan? and can?(:update, item || resource)
    end
    
    def can_show_with_cancan?(item=nil)
      can_show_without_cancan? and can?(:read, item || resource)
    end
    
    def can_destroy_with_cancan?(item=nil)
      can_destroy_without_cancan? and can?(:destroy, item || resource)
    end

    
    
    
  end
end
{'fraction_non_alphanumeric': 0.07775255391600454, 'fraction_numerical': 0.0, 'mean_word_length': 3.279126213592233, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1665788', 'n_tokens_mistral': 610, 'n_tokens_neox': 607, 'n_words': 112}