diff options
author | José Valim <jose.valim@gmail.com> | 2009-06-27 11:05:43 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-06-27 21:29:59 +0200 |
commit | ff48e23a4eb9f4a5fd3a02addb398499fb3c1455 (patch) | |
tree | 373d1db11fec7fb083135586924cc8847f0f832b /railties/lib/generators/active_record/observer | |
parent | 85ff67ce4c0e95de9b855af7f7e7fbab7f7726de (diff) | |
download | rails-ff48e23a4eb9f4a5fd3a02addb398499fb3c1455.tar.gz rails-ff48e23a4eb9f4a5fd3a02addb398499fb3c1455.tar.bz2 rails-ff48e23a4eb9f4a5fd3a02addb398499fb3c1455.zip |
Make Observer generator agnostic.
Diffstat (limited to 'railties/lib/generators/active_record/observer')
-rw-r--r-- | railties/lib/generators/active_record/observer/observer_generator.rb | 11 | ||||
-rw-r--r-- | railties/lib/generators/active_record/observer/templates/observer.rb | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/railties/lib/generators/active_record/observer/observer_generator.rb b/railties/lib/generators/active_record/observer/observer_generator.rb new file mode 100644 index 0000000000..5bc9da34d1 --- /dev/null +++ b/railties/lib/generators/active_record/observer/observer_generator.rb @@ -0,0 +1,11 @@ +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 + end + end +end diff --git a/railties/lib/generators/active_record/observer/templates/observer.rb b/railties/lib/generators/active_record/observer/templates/observer.rb new file mode 100644 index 0000000000..b9a3004161 --- /dev/null +++ b/railties/lib/generators/active_record/observer/templates/observer.rb @@ -0,0 +1,2 @@ +class <%= class_name %>Observer < ActiveRecord::Observer +end |