Today I planned my next project and it was STRESSFUL! I have an idea, but the process of building it is difficult. I realized that I need a lot of practice with rails associations. There are two things that I want a user to be able to do.
I want a user to be able to leave comments and I also want a user to have the ability to like a post.
I am still in the process of creating a schema for my project and look forward to learning how to connect everything. For now, this is what my schema looks like:
create_table "comments", force: :cascade do |t|
t.string "content"
t.integer "user_id"
t.integer "post_id"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["post_id"], name: "index_comments_on_post_id"
t.index ["user_id"], name: "index_comments_on_user_id"
end
create_table "favorites", force: :cascade do |t|
t.boolean "like"
t.integer "user_id"
t.integer "post_id"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["post_id"], name: "index_comments_on_post_id"
t.index ["user_id"], name: "index_comments_on_user_id"
end
create_table "posts", force: :cascade do |t|
t.string "title"
t.text "description"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end
create_table "users", force: :cascade do |t|
t.string "username"
t.text "email"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end
When I complete my schema I will update this article with the updated version. Wish me luck.
Sincerely,
Brittany
Top comments (0)