aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2019-04-11 17:48:58 -0400
committerGitHub <noreply@github.com>2019-04-11 17:48:58 -0400
commit74502964837a2e50d394ec2212eb195a5cfe1d16 (patch)
tree17d429d1a5a0b488e4cc5a3963d129fddea49d35 /guides/source
parent7b6b10542d5dac2b50f2578143dc5d70120d1146 (diff)
parentc816dde055108217a8bd34147a07830dc4063ff8 (diff)
downloadrails-74502964837a2e50d394ec2212eb195a5cfe1d16.tar.gz
rails-74502964837a2e50d394ec2212eb195a5cfe1d16.tar.bz2
rails-74502964837a2e50d394ec2212eb195a5cfe1d16.zip
Merge pull request #35938 from soartec-lab/update_guide_engine_sample_code
Use modele to generate generated defaults [skip ci]
Diffstat (limited to 'guides/source')
-rw-r--r--guides/source/engines.md31
1 files changed, 17 insertions, 14 deletions
diff --git a/guides/source/engines.md b/guides/source/engines.md
index 068f1efae3..84a49bec9b 100644
--- a/guides/source/engines.md
+++ b/guides/source/engines.md
@@ -1129,10 +1129,11 @@ end
```
```ruby
-# Blorgh/app/models/article.rb
-
-class Article < ApplicationRecord
- has_many :comments
+# Blorgh/app/models/blorgh/article.rb
+module Blorgh
+ class Article < ApplicationRecord
+ has_many :comments
+ end
end
```
@@ -1150,12 +1151,13 @@ end
```
```ruby
-# Blorgh/app/models/article.rb
-
-class Article < ApplicationRecord
- has_many :comments
- def summary
- "#{title}"
+# Blorgh/app/models/blorgh/article.rb
+module Blorgh
+ class Article < ApplicationRecord
+ has_many :comments
+ def summary
+ "#{title}"
+ end
end
end
```
@@ -1187,10 +1189,11 @@ end
```
```ruby
-# Blorgh/app/models/article.rb
-
-class Article < ApplicationRecord
- include Blorgh::Concerns::Models::Article
+# Blorgh/app/models/blorgh/article.rb
+module Blorgh
+ class Article < ApplicationRecord
+ include Blorgh::Concerns::Models::Article
+ end
end
```