Sha256: 361a415cfee5a77c22dd7b9517daa9a2b5029ee8d39419cc6f7c6514c49d1023

Contents?: true

Size: 554 Bytes

Versions: 6

Compression:

Stored size: 554 Bytes

Contents

require 'rails3_artifactor'

class ControllerGenerator < Rails::Generators::NamedBase
  desc "Adds method 'control_me' to a Controller" 
    
  def add_helper_method  
    begin
      insert_into_controller name do
        include_txt
      end
    rescue
      say "Controller #{name} does not exist. Please create it first before you can add a controller method to it!", :red
    end
  end

  protected
  
  extend Rails3::Assist::UseMacro
  use_helpers :controller  

  def include_txt
    %{def control_me
    "Control me please!"
  end}
  end

end 

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
generator-spec-0.7.1 spec/generator_spec/fixtures/generators/controller/controller_generator.rb
generator-spec-0.7.0 lib/generators/controller/controller_generator.rb
generator-spec-0.6.6 lib/generators/controller/controller_generator.rb
generator-spec-0.6.5 lib/generators/controller/controller_generator.rb
generator-spec-0.6.4 lib/generators/controller/controller_generator.rb
generator-spec-0.6.3 lib/generators/controller/controller_generator.rb