Home

Awesome

PolymorphicRender

Installing

Add in your gemfile

gem 'polymorphic_render'

Using

Just write in your views instead:

= render @model
-# or
= render @models

this:

= polymorphic_render @model
-# or
= polymorphic_render @models

And.. nothing changes! :) It renders views/models/_model partial and passes model local variable into.

But if you write:

= polymorphic_render @model, :admin
-# or
= polymorphic_render @models, :admin

It renders views/models/_model_admin partial and passes model local variable into.

Array can be passed as second parameter:

= polymorphic_render @model, [:super, :admin]
-# or
= polymorphic_render @models, [:super, :admin]

It renders views/models/_model_super_admin partial and passes model local variable into.

When it's useful?

License

This project rocks and uses MIT-LICENSE.