aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2015-12-16 14:37:57 -0200
committerRafael França <rafaelmfranca@gmail.com>2015-12-16 14:37:57 -0200
commit1d7d8062b2576f835f5475e4adad0bb79e53f8ad (patch)
tree87bbbc5278ccb4ea69b2cf1bb21dbfab203abc52 /railties/lib
parent371e357065edf362144af7f44b7ff0755d1b0165 (diff)
parent2067fff9e38df4e37bdbfc021cd6bb0c2d393a2a (diff)
downloadrails-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')
-rw-r--r--railties/lib/rails/generators/rails/app/app_generator.rb6
-rw-r--r--railties/lib/rails/generators/rails/app/templates/app/models/application_record.rb3
-rw-r--r--railties/lib/rails/generators/rails/plugin/templates/app/models/application_record.rb.tt6
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
+%>