1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #41188 from ijlee2/improve-getting-started

A few continuity improvements to Getting Started page [ci skip]
This commit is contained in:
Rafael França 2021-01-22 14:08:37 -05:00 committed by GitHub
commit 03d3a1b994
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1812,6 +1812,7 @@ In `app/models/article.rb`:
```ruby
class Article < ApplicationRecord
include Visible
has_many :comments
validates :title, presence: true
@ -1824,6 +1825,7 @@ and in `app/models/comment.rb`:
```ruby
class Comment < ApplicationRecord
include Visible
belongs_to :article
end
```
@ -1861,9 +1863,11 @@ Our blog has <%= Article.public_count %> articles and counting!
<ul>
<% @articles.each do |article| %>
<li>
<%= link_to article.title, article %>
</li>
<% unless article.archived? %>
<li>
<%= link_to article.title, article %>
</li>
<% end %>
<% end %>
</ul>
@ -1966,7 +1970,7 @@ class CommentsController < ApplicationController
private
def comment_params
params.require(:comment).permit(:commenter, :body)
params.require(:comment).permit(:commenter, :body, :status)
end
end
```