I have two models(Customer, Product). They are associated with has_one relation. Currently I am doing this
@customer = Customer.first
@customer.product.name
This output, the name of the product and this works just fine. Now I want something like this
product_type = "product"
@customer = Customer.first
@customer."#{product_type}".name
This should output product name like before. How can I achieve this?