This project is archived and is in readonly mode.
Default generator for ActiveModel
-
José Valim
- Assigned user set to José Valim
-
Diego Carrion
Hi, after some talking, I did refactor the patch.
-
José Valim
- Milestone cleared.
Good patch. Just some small changes required:
1) Tests does not pass. The current test fails (ScaffoldControllerGeneratorTest):
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::ActiveModel, skipping controller. " << "Error: no such file to load -- generators/unknown.\n", errorend
It can be removed and replaced by a test that ensures that ORM::Generators::ActiveModel is loaded (instead of Rails::Generators::ActiveModel).
2) ActiveRecord::Generators::ActiveModel can now be removed.
Thanks Carrion!
-
Diego Carrion
My fault, test were not running correctly in my machine.
I fixed the test and removed ActiveRecord::Generators::ActiveModel.
-
Diego Carrion
Hi, any feedback on this?
-
José Valim
I need some time to apply it on a fork and add more tests. Showing that no error is raised is not actually testing that an ActiveModel subclass can be loaded.
-
Diego Carrion
The test that tests that the code is loaded is the scaffold test. Before the updates, it tested that the ActiveRecord generator was being loaded but that generator doesnt exists anymore, so tests will fail now unless the default generator is being loaded correctly.
-
José Valim
Exactly, so right now, we don't have any test that ensures that ORM::Generators::ActiveModel is loaded, because ActiveRecord is now using the default Rails::Generators::ActiveModel. In other words, we are just testing the fallback.
-
Repository
(from [1f9d234a6b567e68d97e71da6f19bd126e7f7058]) By default use ActiveModel API in controller generators, unless otherwise specified [#3123 Default generator for ActiveModel status:resolved] http://github.com/rails/rails/commit/1f9d234a6b567e68d97e71da6f19bd...
-
José Valim
- State changed from new to resolved
