mandytrex / workout_buddy

0 stars 0 forks source link

Schema problem #2

Closed mandytrex closed 9 years ago

mandytrex commented 9 years ago

@htella @harimohanraj89 @DrRobotmck

I would like to have an end_date attribute within my Goals table.

Currently my schema for Goals is as follows: create_table "goals", force: true do |t| t.text "goal" t.string "theme" t.boolean "achieved" t.string "end_date" t.text "image_url" t.boolean "public" t.integer "group_id" t.datetime "created_at" t.datetime "updated_at" end

I currently have this to be a string type. What do you recommend using for the attribute type for a future date that the user will input when creating their goal? I know that there is a "date" type that can be used for my database, which I believe would look like:

t.date "end_date" ?

I do not want it to just save the creation date, I want to save a date which will be chosen by the user. In the research I've done, it seems that t.date will not do that.

harimohanraj89 commented 9 years ago

The date type can do that. The automatic creation date thing will only happen if the column is named "created_at". Any other name, you should be able to set its value to anything you want.

mandytrex commented 9 years ago

Okay, thanks!