Ruby on Rails - Railscasts PRO #17- HABTM Checkboxes (revised)
Why Stack Overflow recommends it
Stack Overflow users link it as the reference tutorial when building or debugging check box forms for has_many :through associations in Rails.
Recommended by 0 people across 0 different months, 2015 to 2017.
What it is
A six-minute Railscasts PRO episode (revised) showing how to edit a many-to-many association in a Rails form using check boxes with a has_many :through relationship. It also covers making the labels clickable. It is presented as a screencast on the Railscasts Reloaded channel.
What people said
Cites Skiapex · 2015-09 · Stack Overflow · on “has_many :through and collection_select rails form”
I have tried all of the solutions to similar problems and haven't gotten this one figured out. I have a has_many :through relationship between 'Clinician', and 'Patient' with a joined model 'CareGroupAssignment'. None of the methods I have tried so far been able to save the clinician to patient association. I would like to have a patient be able to have multiple clinicians associated with it and clinicians will have multiple patients . clinician.rb (simplified) class Clinician < ActiveRecord::Base belongs_to :care_group has_many :patients ,:through=> :care_group_assignments has_many :care_group_assignments, :dependent => :destroy belongs_to :user accepts_nested_attributes_for :user, :allow_d
Cites Skiapex · 2015-09 · Stack Overflow · on “has_many :throught not INSTERING INTO database from form”
I have tried all of the solutions to similar problems and haven't gotten this one figured out. I have a has_many :through relationship between 'Clinician', and 'Patient' with a joined model 'CareGroupAssignment'. I would like to have a patient be able to have multiple clinicians associated with it and clinicians will have multiple patients . When I submit my form this is logged: Started POST "/patients" for 127.0.0.1 at 2015-09-02 14:56:38 -0700 Processing by PatientsController#create as HTML Parameters: {"utf8"=>"✓", "authenticity_token"=>"XXX=", "patient"=>{"user_attributes"=>{"email"=>"allencentre", "password"=>"[FILTERED]"}, "first_name"=>"Allen", "last_name"=>"Centre", "birth_date(1i)"=
Cites tintin · 2016-12 · Stack Overflow · on “Ruby on rails 4 check_box_tag not showing up in form”
I'm a RoR newbie trying to create a form. I want to be able to save all of the values from the form and run a search query on my database based on the values before returning an updated view. I'm on rails 4, and created an array of check boxes using this tutorial: [this video] , but the check boxes won't show up. I can't seem to find a solution by myself, so I was hoping for some help. This is my form: [LINK] This is my form.html.erb. It's saved in views/homepage/form.html.erb <div class="row"> <div class="col-md-6 col-md-offset-3"> <%= form_for(@homepage, url: form_path) do |f| %> # <%= render 'shared/error_messages_form' %> <%= f.label :dname, "Dish Name" %> <%= f.text_field :d_name %> <%= f.la
Cites ddonche · 2017-05 · Stack Overflow · on “check_box_tag prints all object info to form view”
I have two Models with a has many through relationship, and I'm trying to get the form to work properly. I followed the Railscast here [this video] for it, and I'm also looking at the API dock on it here [LINK] . The code in question is this in my form: <%= Region.all.each do |region| %> <%= check_box_tag 'religion[region_ids][]', region.id %> <%= region.name %><br /> <% end %> It properly puts out the checkboxes and the names of the regions, but it also prints all the info on each region. [LINK] Can anyone tell me why it's doing that?