jendiamond / railsgirls-signup

https://railsgirls-signup.herokuapp.com
3 stars 3 forks source link

Add Questions to the Form #35

Closed jendiamond closed 7 years ago

jendiamond commented 7 years ago

Pull Request #41

Add Questions to the Form

Changed has_many :questions to has_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

<%= form_for(@topic) do |topic_form| %>
  ...fields...
  <%= topic_form.fields_for :linkers do |linker_form| %>
    ...linker fields...
    <%= linker_form.fields_for :article do |article_form| %>
      ...article fields...

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"}

jendiamond commented 7 years ago

http://stackoverflow.com/questions/13537206/how-do-i-convert-boolean-values-to-integers

inflection_point = (firm.inflection_point ? 1 : 0)

jendiamond commented 7 years ago

Add questions for rating to the form

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.

  1. I am a total newbie :)
  2. I am a bit familiar with HTML / CSS
  3. I am very familiar with HTML / CSS
  4. I have done online Ruby / Rails tutorials
  5. I attend Study Group
  6. I have written a program (any language)
  7. I have created a website and launched it on the web
  8. I currently work in tech
  9. I have attended an immersive bootcamp program
  10. I have or am getting a CS degree
  11. I have attended Rails Girls / Railsbridge
  12. Do you think you will continue learning to program after the workshop.
  13. Do you have any people to support you with this goal?