Method: CurateGenerator#inject_controller_behavior

Defined in:
lib/generators/curate/curate_generator.rb

#inject_controller_behaviorObject

Add behaviors to the application controller



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/generators/curate/curate_generator.rb', line 34

def inject_controller_behavior
  controller_name = "ApplicationController"
  file_path = "app/controllers/application_controller.rb"
  if File.exists?(file_path)
    insert_into_file file_path, :after => 'include Blacklight::Controller' do
      "\n  include CurateController\n"
    end
    gsub_file file_path, "layout 'blacklight'", ""
  else
    puts "     \e[31mFailure\e[0m  Could not find #{file_path}.  To add Curate behaviors to your ApplicationController, you must include the CurateController module in the ApplicationController class definition."

  end
end