I am building an application for test case management system. I have testcases and testruns. I am joining these 2 tables through assocation model called testresults.
class Testcase < ActiveRecord::Base
has_many :testresults
has_many :testruns, :through => :testresults
class Testrun < ActiveRecord::Base
has_many :testresults
has_many :testcases, :through => :testresults
class Testresult < ActiveRecord::Base
belongs_to :testrun
belongs_to :testcase
There is a fixed set of testcases already existing. Everytime I create a new testrun, I want to select a number of existing testcases and add to the new testrun.
I am not sure about the following things. If you could please give me some pointers about what approach should I take and what methods/functions/helpers should I use, I will be grateful. I have wasted more than a day on it going through different posts but not able to see things clearly.
- View - How to populate the existing testcases with checkboxes in front of them. Do I use options_from_collection_for_select? But how do i get checkboxes
- Do I use testrun model or the assocation model i.e. testresult. I am confused about where to show the added testcases - on the testrun page or testresult page.
- Do we create views, and use controllers for the assocaition model as well?