search for: select_from_hash

Displaying 3 results from an estimated 3 matches for "select_from_hash".

2010 Jun 17
3
Can i use a hash on a collection_select? If don't, alternatives.
In my current application, i have food categories: mexican, home made, japanese, ect As these categories only have ID and name, no other attributes, i dont want to create a table on the DB. My first idea was to create a constant named FOOD_CATEGORIES, that is has like: FOOD_CATEGORIES = { 1=>''mexican'', 2=>''japanese'',
2006 Jan 04
2
collection_select with array as source
I would like to use the collection_select with a simply array as the source of the collection. My array looks like this: STATES = ["Alabama", "Alaska", "Texas"] and it is stored in my environment.rb I can''t figure out the syntax for the collection_select in this situation... collection_select("my_object", "state", what goes here??? ) I
2006 Jul 01
3
best approach to add form elements dynamically
I am struggling with how to add dynamically add form elements to a form based on user action. Now here is my situation: I have model Project that has_many line_items On the form to create a project I initially display form elements (some drop downs and text boxes) for adding just one line_item. There is also a button or a link on the page (not sure if this should be in the main form or