I have a partial, that generates a list of categories. I'd like to
use the same partial for two different scenarios where data will be
coming from different models. In one case, the partial is grabbing
category data directly from the Category model. In another case it's
grabbing it from an associated UserCategory model.
Based on the associations, in one scenario, i'd display the category
name like this in the loop: category.name. In the other scenario
(where I'm first retrieving category info through the UserCategory
model, I'd display it like: category.category.name.
What's the best way to use one partial for both situations? Do I
alias category name somehow in the model so it can work for both
I look forward to your suggestions.