Skip to content

mdchaney/cuisine_testers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a simple example for this question on stackoverflow:

stackoverflow.com/questions/27064161/has-many-through-association-not-inserting-values-in-params-to-join-table-instea/27064812

This application was written for Rails 3.2.21 and would be written slightly differently for Rails 4, particularly with regards to strong parameters and such.

There are two main sets of data: testers and cuisines. When editing a tester the user may choose a set of cuisines for that tester. When editing a cuisine the user may choose a set of testers. The ratings table is the connector between the two.

I didn’t make any tests for this app, so the files in the “test” directory were automatically generated and of no value.

Stick this in a directory and run these commands:

bundle install
rake db:migrate
rake db:seed
rails s

At that point you should have the development server running on:

127.0.0.1:3000/

Connect up and you can modify either testers or cuisines.

In “cuisines”, you can see a standard multi-select list box for testers. In “testers”, you can see a set of check boxes for cuisines. Note that in Rails 4 there is a “collection_check_boxes” method for the form builder which would take the place of the 8 or so lines of code that draw the check boxes.

This code is released into the Public Domain and I renounce the copyright on the parts written by me (Michael Chaney - mdchaney@michaelchaney.com). Use it as you like.

About

Cuisine Testers app - example for stackoverflow question

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors