forked from yusukedayo/mokumoku
-
Notifications
You must be signed in to change notification settings - Fork 0
事業課題2: 実装 #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mtokna7
wants to merge
8
commits into
develop
Choose a base branch
from
implementation
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
事業課題2: 実装 #2
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2931510
事業課題2:提案1回目
319f648
指定のgemを追加
0b03721
add:usersテーブルにprofileカラムとhobbyカラム
ab29172
profile, hobbyの登録機能を実装
429cdd3
ユーザー詳細情報関係の実装完了
6fb928b
フォロー関連実装完了
13333cf
指摘箇所の修正
763882a
修正:ログアウト中はフォロー関連の表示がされないように
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,3 +40,6 @@ yarn-debug.log* | |
| .yarn-integrity | ||
|
|
||
| /config/credentials/production.key | ||
|
|
||
| /vendor/bundle | ||
| .DS_Store | ||
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| class FollowingsController < ApplicationController | ||
|
|
||
| def create | ||
| current_user.follow(params[:user_id]) | ||
| redirect_back fallback_location: users_path | ||
| end | ||
|
|
||
| def destroy | ||
| current_user.unfollow(params[:user_id]) | ||
| redirect_back fallback_location: users_path | ||
| end | ||
| end | ||
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| class FollowingDecorator < Draper::Decorator | ||
| delegate_all | ||
|
|
||
| # Define presentation-specific methods here. Helpers are accessed through | ||
| # `helpers` (aka `h`). You can override attributes, for example: | ||
| # | ||
| # def created_at | ||
| # helpers.content_tag :span, class: 'time' do | ||
| # object.created_at.strftime("%a %m/%d/%y") | ||
| # end | ||
| # end | ||
|
|
||
| end |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| class Following < ApplicationRecord | ||
| belongs_to :follower, class_name: "User" | ||
| belongs_to :followed, class_name: "User" | ||
| validates :follower_id, presence: true | ||
| validates :followed_id, presence: true | ||
|
Comment on lines
+2
to
+5
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 念のため |
||
| validates :follower_id, uniqueness: {scope: :followed_id} | ||
| end | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| <li> | ||
| <div class="d-flex align-items-center gap-2 mb-3"> | ||
| <%= image_tag attendee.decorate.avatar, class: 'rounded-circle avatar-md' %> | ||
| <%= attendee.name %> | ||
| <%= link_to attendee.name, user_path(attendee) %> | ||
| </div> | ||
| </li> |
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <h1>ユーザー情報</h1> | ||
| <p>name: <%= @user.name %></p> | ||
| <p>hobby: <%= @user.hobby %></p> | ||
| <p>profile: <%= @user.profile %></p> | ||
| <% if logged_in? && current_user != @user %> | ||
| <% if current_user.following?(@user) %> | ||
| <%= link_to "フォローを外す", user_followings_path(@user.id), method: :delete %> | ||
| <% else %> | ||
| <%= link_to "フォローする", user_followings_path(@user.id), method: :post %> | ||
| <% end %> | ||
| <% end %> |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| class AddHobbyToUsers < ActiveRecord::Migration[6.1] | ||
| def change | ||
| add_column :users, :hobby, :string | ||
| end | ||
| end |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| class AddProfileToUsers < ActiveRecord::Migration[6.1] | ||
| def change | ||
| add_column :users, :profile, :string | ||
| end | ||
| end |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| class CreateFollowings < ActiveRecord::Migration[6.1] | ||
| def change | ||
| create_table :followings do |t| | ||
| t.integer :follower_id | ||
| t.integer :followed_id | ||
|
|
||
| t.timestamps | ||
| end | ||
| add_index :followings, :follower_id | ||
| add_index :followings, :followed_id | ||
| add_index :followings, [:follower_id, :followed_id], unique: true | ||
| end | ||
| end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| RSpec.configure do |config| | ||
| config.before(:each, type: :system) do | ||
| driven_by :selenium, using: :headless_chrome, screen_size: [1920, 1080] | ||
| end | ||
| end |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| module LoginMacros | ||
| def login(user) | ||
| visit login_path | ||
| fill_in 'email', with: user.email | ||
| fill_in 'password', with: 'password' | ||
| click_button 'ログイン' | ||
| end | ||
| end |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
モデルにロジックを寄せられていて良いですね👍