Closed jendiamond closed 7 years ago
http://stackoverflow.com/questions/13537206/how-do-i-convert-boolean-values-to-integers
inflection_point = (firm.inflection_point ? 1 : 0)
You don't need to have experience to attend, just excitement and an interest. We just need to know a few things to help us group the students better at the event.
Pull Request #41
Add Questions to the Form
Changed
has_many :questions
tohas_one :question
with help from @thomasjinlo
http://stackoverflow.com/questions/2182428/rails-nested-form-with-has-many-through-how-to-edit-attributes-of-join-model
rails g migration add_question_id_to_user question_id:integer rails g migration add_user_id_to_question user_id:integer
User.first.create_question(newbie:true) User.first.question
User.create_tutorial(newbie: true) User.tutorial=Tutorial.new Tutorial.new(newbie: true, user_id:1)
rails g migration remove_question_id_from_user question_id:integer
user2 = User.first
User Load (1.9ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT $1 [["LIMIT", 1]] => #<User id: 1, first_name: "Burdette", last_name: "Larkin", email: "jane@email.com", phone: "715-159-1983", zip_code: "73716", twitter_handle: "Lon", github_user_name: nil, over_21: false, age: nil, operating_system: "Mac", workshop: nil, rating: nil, coach: nil, pair: nil, accepted: nil, attended: nil, phase_five_coach: nil, created_at: "2016-07-31 03:23:17", updated_at: "2016-07-31 03:23:17">
user2.question.newbie
Question Load (1.1ms) SELECT "questions".* FROM "questions" WHERE "questions"."user_id" = $1 LIMIT $2 [["user_id", 1], ["LIMIT", 1]] => true
"first_name"=>"Choco", "last_name"=>"Chip", "email"=>"chocochip@email.com", "twitter_handle"=>"chocochip", "github_user_name"=>"chocochip", "phone"=>"3233630002", "zip_code"=>"90026", "over_21"=>"1", "age"=>"", "operating_system"=>"Linux", "question_attributes"=>{"newbie"=>"1", "html_css"=>"0", "tutorials"=>"1", "study_group"=>"0", "program"=>"1", "website"=>"0", "work"=>"1", "bootcamp"=>"0", "compsci"=>"1", "rlsgrl_rlsbrg"=>"0", "continue"=>"yes", "support"=>"yes", "experience"=>"yes"}}, "commit"=>"SUBMIT"}