У меня есть модель PaymentDetail с атрибутом 'home_address_country', поэтому я могу использовать
@payment_detail.home_address_country //where @payment_detail is object of that model.
Я хочу использовать что-то вроде этого: ---
country_attribute=address_type+"_address_country" //where address type is equal to 'home'
@payment_detail."#{country_attribute}"
Имя атрибута средства хранится в переменной.Как я могу это сделать?
РЕДАКТИРОВАТЬ
country_attribute=address_type+"_address_country"
country_list=Carmen::country_names
eval("@#{country_attribute} = #{country_list}")