@revenue_category
is a ActiveRecord object that contains one row from my revenues table which was retrieved with Revenue.all(:order => "revenue_made")
and then sorted out. So each of its attributes is a column name, and the value of the attribute is what is stored in that column for that particular row.
@revenue_category
looks like this:
--- !ruby/ActiveRecord:Revenue
attributes:
id: 1
revenue_made: 3000000
premium_option_a_cost: 250
premium_option_b_cost: 450
premium_option_c_cost: 650
@option_picked
looks like this:
picked_option_(could be a,b or c)_cost
How do I access a particular attribute of an ActiveRecord instance variable when the name of that attribute is stored in another instance variable?