diff options
author | José Valim <jose.valim@gmail.com> | 2009-08-08 11:22:47 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-08-08 17:48:07 +0200 |
commit | 469d89dd442dc8590575daad4ae9052c229c917f (patch) | |
tree | bd7404ce09b124521f11aeefb274f6a6182544b8 | |
parent | 6e0ac748e41e8de8111095f7188c75f673779f93 (diff) | |
download | rails-469d89dd442dc8590575daad4ae9052c229c917f.tar.gz rails-469d89dd442dc8590575daad4ae9052c229c917f.tar.bz2 rails-469d89dd442dc8590575daad4ae9052c229c917f.zip |
Rename Rails::Generators::ActionORM to Rails::Generators::ActiveModel.
-rw-r--r-- | railties/lib/generators/active_model.rb (renamed from railties/lib/generators/action_orm.rb) | 14 | ||||
-rw-r--r-- | railties/lib/generators/active_record.rb | 4 | ||||
-rw-r--r-- | railties/lib/generators/named_base.rb | 10 | ||||
-rw-r--r-- | railties/test/generators/scaffold_controller_generator_test.rb | 2 |
4 files changed, 15 insertions, 15 deletions
diff --git a/railties/lib/generators/action_orm.rb b/railties/lib/generators/active_model.rb index 69cf227fd7..1a849a0e02 100644 --- a/railties/lib/generators/action_orm.rb +++ b/railties/lib/generators/active_model.rb @@ -1,6 +1,6 @@ module Rails module Generators - # ActionORM is a class to be implemented by each ORM to allow Rails to + # ActiveModel is a class to be implemented by each ORM to allow Rails to # generate customized controller code. # # The API has the same methods as ActiveRecord, but each method returns a @@ -8,22 +8,22 @@ module Rails # # For example: # - # ActiveRecord::Generators::ActionORM.find(Foo, "params[:id]") + # ActiveRecord::Generators::ActiveModel.find(Foo, "params[:id]") # #=> "Foo.find(params[:id])" # - # Datamapper::Generators::ActionORM.find(Foo, "params[:id]") + # Datamapper::Generators::ActiveModel.find(Foo, "params[:id]") # #=> "Foo.get(params[:id])" # - # On initialization, the ActionORM accepts the instance name that will + # On initialization, the ActiveModel accepts the instance name that will # receive the calls: # - # builder = ActiveRecord::Generators::ActionORM.new "@foo" + # builder = ActiveRecord::Generators::ActiveModel.new "@foo" # builder.save #=> "@foo.save" # - # The only exception in ActionORM for ActiveRecord is the use of self.build + # The only exception in ActiveModel for ActiveRecord is the use of self.build # instead of self.new. # - class ActionORM + class ActiveModel attr_reader :name def initialize(name) diff --git a/railties/lib/generators/active_record.rb b/railties/lib/generators/active_record.rb index 64bee3904e..924b70881a 100644 --- a/railties/lib/generators/active_record.rb +++ b/railties/lib/generators/active_record.rb @@ -1,6 +1,6 @@ require 'generators/named_base' require 'generators/migration' -require 'generators/action_orm' +require 'generators/active_model' require 'active_record' module ActiveRecord @@ -20,7 +20,7 @@ module ActiveRecord end end - class ActionORM < Rails::Generators::ActionORM #:nodoc: + class ActiveModel < Rails::Generators::ActiveModel #:nodoc: def self.all(klass) "#{klass}.all" end diff --git a/railties/lib/generators/named_base.rb b/railties/lib/generators/named_base.rb index 699b8ed651..9632e6806c 100644 --- a/railties/lib/generators/named_base.rb +++ b/railties/lib/generators/named_base.rb @@ -124,18 +124,18 @@ module Rails protected - # Loads the ORM::Generators::ActionORM class. This class is responsable + # Loads the ORM::Generators::ActiveModel class. This class is responsable # to tell scaffold entities how to generate an specific method for the - # ORM. Check Rails::Generators::ActionORM for more information. + # ORM. Check Rails::Generators::ActiveModel for more information. # def orm_class @orm_class ||= begin # Raise an error if the class_option :orm was not defined. unless self.class.class_options[:orm] - raise "You need to have :orm as class option to invoke orm_class and orm_instance" + raise "You need to have :orm as class option to invoke orm_class and orm_instance" end - action_orm = "#{options[:orm].to_s.classify}::Generators::ActionORM" + action_orm = "#{options[:orm].to_s.classify}::Generators::ActiveModel" # If the orm was not loaded, try to load it at "generators/orm", # for example "generators/active_record" or "generators/sequel". @@ -152,7 +152,7 @@ module Rails end end - # Initialize ORM::Generators::ActionORM to access instance methods. + # Initialize ORM::Generators::ActiveModel to access instance methods. # def orm_instance(name=file_name) @orm_instance ||= @orm_class.new(name) diff --git a/railties/test/generators/scaffold_controller_generator_test.rb b/railties/test/generators/scaffold_controller_generator_test.rb index 024ea439ef..834e43e776 100644 --- a/railties/test/generators/scaffold_controller_generator_test.rb +++ b/railties/test/generators/scaffold_controller_generator_test.rb @@ -99,7 +99,7 @@ class ScaffoldControllerGeneratorTest < GeneratorsTestCase def test_error_is_shown_if_orm_does_not_provide_interface error = capture(:stderr){ run_generator ["User", "--orm=unknown"] } - assert_equal "Could not load Unknown::Generators::ActionORM, skipping controller. " << + assert_equal "Could not load Unknown::Generators::ActiveModel, skipping controller. " << "Error: no such file to load -- generators/unknown.\n", error end |