<commit_before>require 'action_dispatch/routing/mapper'

# Override +resources+ method
# Add +wulin_master_new_form+ and +wulin_master_edit_form+ action
# FIXME : Find a better way to add this two actions
class ActionDispatch::Routing::Mapper
  
  def resources(*resources, &block)
    options = resources.extract_options!

    if apply_common_behavior_for(:resources, resources, options, &block)
      return self
    end

    resource_scope(:resources, Resource.new(resources.pop, options)) do
      yield if block_given?

      collection do
        get  :wulin_master_new_form
        get  :wulin_master_edit_form
        get  :index if parent_resource.actions.include?(:index)
        post :create if parent_resource.actions.include?(:create)
      end

      new do
        get :new
      end if parent_resource.actions.include?(:new)

      member do
        get    :edit if parent_resource.actions.include?(:edit)
        get    :show if parent_resource.actions.include?(:show)
        put    :update if parent_resource.actions.include?(:update)
        delete :destroy if parent_resource.actions.include?(:destroy)
      end
    end

    self
  end
  
end<commit_msg>MISC - Refactor routing mapper extension<commit_after>module WulinMaster 
  module FormResourceRoute
    def resources(*args, &block)
      super(*args) do
        yield if block_given?
        collection do
          get  :wulin_master_new_form
          get  :wulin_master_edit_form
        end
      end
    end
  end
end

ActionDispatch::Routing::Mapper.send(:include, WulinMaster::FormResourceRoute)
{'fraction_non_alphanumeric': 0.07784810126582278, 'fraction_numerical': 0.0, 'mean_word_length': 3.0852713178294575, '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': '7430247', 'n_tokens_mistral': 462, 'n_tokens_neox': 453, 'n_words': 115}