RenderPartialWithPrefixes
RenderPartalWithPrefixes adds an options 'prefixes' to render :partial in order to be able to have view inheriantance work based on the resouce being rendered, rather than the current controller.
I'm open to the idea that there might be a better way to do this than monkey patching ActionView.
This has only been tested with Rails 4.0.2, and likely won't work on anything else.
Installation
Add this line to your application's Gemfile:
gem 'render_partial_with_prefixes'
And then execute:
$ bundle
Or install it yourself as:
$ gem install render_partial_with_prefixes
Usage
render :partial => 'user', :prefixes => [:users, :admins, :members], locals: @search_result
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request