Skip to content

Instantly share code, notes, and snippets.

@cjavdev
Created September 13, 2013 04:15
Show Gist options
  • Save cjavdev/6546728 to your computer and use it in GitHub Desktop.
Save cjavdev/6546728 to your computer and use it in GitHub Desktop.
polymorphic routes problem
resources :traders { resources :notes }
resources :companies { resources :notes }
# need condition for each polymorphic type
if (params[:trader_id])
@notes = Trader.find(params[:trader_id]).notes
elsif (params[:company_id])
@notes = Company.find(params[:company_id]).notes
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment