I have resources for which it makes sense to consider them as embedded in other resources, or separately. That is, I expect to use all urls like these:
/account/4/transfers
my concern is how I can write TransfersController actions (like index) since this will double the logic found in parent models - is there a better way than doing something like
TransfersController ... def index if !params[account_id].nil? @account = Account.find(params[account_id]) @transfers = @account.transfers elsif !params[user_id].nil? @user = User.find(params[user_id]) if @user.accesible_by?(current_user) @transfers = @user.transfers end elsif !params[projects_id].nil? .....
and the same thing applies to submissions - although they will all list transmissions, they will have different headers, navigation, etc. for user, account, project, ...
I hope you see a sample from this example. I think there must be some ugly solution for this. Basically, I would like to separate the logic that selects the displayed translations and other things, such as the contextual parts of the review.
source share