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:
commit
03d3a1b994
1 changed files with 8 additions and 4 deletions
|
@ -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
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue