diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2009-09-30 22:27:02 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-09-30 22:27:02 +0100 |
commit | dd2779e1b83b4d867d47dd286ec0c919f5df12a9 (patch) | |
tree | 6e52ea0a329c24429f4d1d41b065e082f0ed6baa /railties/lib/rails/generators/active_record/observer | |
parent | 329b14aa8fdd291a00d17ba12c2e0ab4c3a157cc (diff) | |
parent | 420004e030e96f2ace6e27fd622c90ee9e986677 (diff) | |
download | rails-dd2779e1b83b4d867d47dd286ec0c919f5df12a9.tar.gz rails-dd2779e1b83b4d867d47dd286ec0c919f5df12a9.tar.bz2 rails-dd2779e1b83b4d867d47dd286ec0c919f5df12a9.zip |
Merge commit 'mainstream/master'
Diffstat (limited to 'railties/lib/rails/generators/active_record/observer')
-rw-r--r-- | railties/lib/rails/generators/active_record/observer/observer_generator.rb | 15 | ||||
-rw-r--r-- | railties/lib/rails/generators/active_record/observer/templates/observer.rb | 2 |
2 files changed, 17 insertions, 0 deletions
diff --git a/railties/lib/rails/generators/active_record/observer/observer_generator.rb b/railties/lib/rails/generators/active_record/observer/observer_generator.rb new file mode 100644 index 0000000000..c1c0e3f25b --- /dev/null +++ b/railties/lib/rails/generators/active_record/observer/observer_generator.rb @@ -0,0 +1,15 @@ +require 'rails/generators/active_record' + +module ActiveRecord + module Generators + class ObserverGenerator < Base + check_class_collision :suffix => "Observer" + + def create_observer_file + template 'observer.rb', File.join('app/models', class_path, "#{file_name}_observer.rb") + end + + hook_for :test_framework + end + end +end diff --git a/railties/lib/rails/generators/active_record/observer/templates/observer.rb b/railties/lib/rails/generators/active_record/observer/templates/observer.rb new file mode 100644 index 0000000000..b9a3004161 --- /dev/null +++ b/railties/lib/rails/generators/active_record/observer/templates/observer.rb @@ -0,0 +1,2 @@ +class <%= class_name %>Observer < ActiveRecord::Observer +end |