Ruby on Railsの学習でTwitterを作成
- メールアドレスで会員登録
- 140文字以内で「つぶやき」を投稿
- フォロー機能
- いいね!機能
- 返信機能
- 検索機能
Twitterにはない、簡単会話機能を実装
簡単な会話を楽しむことができる
column |
Type |
Option |
name |
string |
null: false, unique: true |
nickname |
string |
null: false |
email |
varchar |
null: false, unique: true |
password |
varchar |
null: false, |
introduction |
text |
|
avatar |
string |
|
wallpaper |
string |
|
- has_many : tweets, dependent: :destroy
- has_many :likes
- has_many :like_tweets, through: :likes, source: :tweet
- has_many :active_relationships, class_name: "Relationship",foreign_key: "follower_id", dependent: :destroy
- has_many :passive_relationships, class_name: "Relationship", foreign_key: "followed_id", dependent: :destroy
- has_many :following, through: :active_relationships, source: :followed
- has_many :followers, through: :passive_relationships, source: :follower
tweets tables
column |
Type |
Option |
content |
text |
null: false |
image |
string |
|
likes_count |
integer |
|
reply_nickname |
string |
|
reply_tweet |
integer |
|
- belongs_to :user
- has_many :likes, dependent: :destroy
column |
Type |
Option |
follower_id |
integer |
null: false |
followed_id |
integer |
null: false |
- belongs_to :followers, class_name: "User"
- belongs_to :following, class_name: "User"
column |
Type |
Option |
user |
string |
null: false, foreign_key: true |
tweet |
string |
null: false, foreign_key: true |
- belongs_to : user
- belongs_to : tweet, counter_cache: :likes_count