Open
Conversation
app/assets/stylesheets/custom.scss
Outdated
| overflow: auto; | ||
| margin-top: 10px; | ||
| .gravatar { | ||
| margin: 1px 1px; |
|
|
||
| def logged_in_user | ||
| return if logged_in? | ||
| store_location |
There was a problem hiding this comment.
indent thẳng hàng dòng trên nhé, cả 3 dòng này luôn
| redirect_to root_url | ||
| else | ||
| @feed_items = [] | ||
| render "static_pages/home" |
There was a problem hiding this comment.
sao file này hình như của chap 13 mà em ?
Owner
Author
There was a problem hiding this comment.
cái này lúc em sửa chap 13 ko rails s chạy lại nên thiếu end, sang chap 14 em mới sửa ạ ✌️
| current_user.follow user | ||
| respond_to do |format| | ||
| format.html { redirect_to @user } | ||
| format.js |
app/helpers/relationships_helper.rb
Outdated
| @@ -0,0 +1,2 @@ | |||
| module RelationshipsHelper | |||
app/models/user.rb
Outdated
| has_many :microposts, dependent: :destroy | ||
| has_many :active_relationships, class_name: "Relationship", | ||
| foreign_key: "follower_id", | ||
| dependent: :destroy |
app/models/user.rb
Outdated
| dependent: :destroy | ||
| has_many :passive_relationships, class_name: "Relationship", | ||
| foreign_key: "followed_id", | ||
| dependent: :destroy |
app/models/user.rb
Outdated
| format: { with: VALID_EMAIL_REGEX }, | ||
| uniqueness: { case_sensitive: false } | ||
| format: { with: VALID_EMAIL_REGEX }, | ||
| uniqueness: { case_sensitive: false } |
| end | ||
|
|
||
| def feed | ||
| following_ids = "SELECT followed_id FROM relationships |
There was a problem hiding this comment.
có thể đổi sang query của active record ko em
| @@ -0,0 +1,2 @@ | |||
| $("#follow_form").html("<%= escape_javascript(render("users/unfollow")) %>"); | |||
There was a problem hiding this comment.
em dùng như sau nhé: <%= j render "users/unfollow" %>, cả file bên dưới nữa
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.