diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2015-12-16 14:37:57 -0200 |
---|---|---|
committer | Rafael França <rafaelmfranca@gmail.com> | 2015-12-16 14:37:57 -0200 |
commit | 1d7d8062b2576f835f5475e4adad0bb79e53f8ad (patch) | |
tree | 87bbbc5278ccb4ea69b2cf1bb21dbfab203abc52 /railties/lib | |
parent | 371e357065edf362144af7f44b7ff0755d1b0165 (diff) | |
parent | 2067fff9e38df4e37bdbfc021cd6bb0c2d393a2a (diff) | |
download | rails-1d7d8062b2576f835f5475e4adad0bb79e53f8ad.tar.gz rails-1d7d8062b2576f835f5475e4adad0bb79e53f8ad.tar.bz2 rails-1d7d8062b2576f835f5475e4adad0bb79e53f8ad.zip |
Merge pull request #22567 from gsamokovarov/introduce-application-record
Introduce ApplicationRecord, an Active Record layer supertype
Diffstat (limited to 'railties/lib')
3 files changed, 15 insertions, 0 deletions
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index 889154494d..9997cf3b35 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -293,6 +293,12 @@ module Rails end end + def delete_application_record_skipping_active_record + if options[:skip_active_record] + remove_file 'app/models/application_record.rb' + end + end + def delete_active_record_initializers_skipping_active_record if options[:skip_active_record] remove_file 'config/initializers/active_record_belongs_to_required_by_default.rb' diff --git a/railties/lib/rails/generators/rails/app/templates/app/models/application_record.rb b/railties/lib/rails/generators/rails/app/templates/app/models/application_record.rb new file mode 100644 index 0000000000..10a4cba84d --- /dev/null +++ b/railties/lib/rails/generators/rails/app/templates/app/models/application_record.rb @@ -0,0 +1,3 @@ +class ApplicationRecord < ActiveRecord::Base + self.abstract_class = true +end diff --git a/railties/lib/rails/generators/rails/plugin/templates/app/models/application_record.rb.tt b/railties/lib/rails/generators/rails/plugin/templates/app/models/application_record.rb.tt new file mode 100644 index 0000000000..8aa3de78f1 --- /dev/null +++ b/railties/lib/rails/generators/rails/plugin/templates/app/models/application_record.rb.tt @@ -0,0 +1,6 @@ +<%= wrap_in_modules <<-rb.strip_heredoc + class ApplicationRecord < ActiveRecord::Base + self.abstract_class = true + end +rb +%> |