Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module EasySelectFields
- def easy_select_fields(a,options)
- type_method_name = "#{a}_types".to_sym
- array = options.each_with_index.map {|o,i| [o, i += 1] }
- class_eval "def self.#{a}_types() #{array.inspect} end"
- end
- end
- class Person
- extend EasySelectFields
- easy_select_fields "status", ["Interested", "Not Interested", "Available"]
- end
Add Comment
Please, Sign In to add comment