I have an Item class with many attributes but for this case lets say it has a name, detail, inventory_count, price on it. in These are all ruby primitives.
I would like to get back a hash of like 'name' and 'detail' such that:
vals=%[name detail] item=Item.find(23) # somethign like??? g={} vals.map { |atr| g[atr]=item.??? } or some other technique. How would I take a string representation and get the attribute of an instance? Is there an easier / better way to do this?
edit 1
looks like send might do it. Let me check