search for: enum_with_index

Displaying 2 results from an estimated 2 matches for "enum_with_index".

2009 Apr 12
4
Can't get an Array function to be visible inside ApplicationHelper
Folks, I seem to be missing something basic here. I am trying to call a function from my application layout that will return me a hash of the roles for the user currently signed in. Here is the simplified code I have in ApplicationHelper module class Array def to_h Hash[*enum_with_index.to_a.flatten] end end def get_cur_user_roles ["school_admin", "General2"].to_h end I call get_cur_user_roles from my layout file. When I bring up the web page I get an error that says undefined method `to_h'' for ["school_admin", "General2...
2009 May 07
13
what database field type should i use ??
in a database table if there is a field which has a certain set of fixed values. for example staus => {Single, Married, Divorced } OR state => {California, Albama, Olaska ...} so what should be preferred way out of the following for storing the values 1. Keep the field as "string(Rails)" VARCHAR(MySQL) itself ....and while showing the field just show the field value. 2. Keep