Take the 2-minute tour ×  I was wondering if I could execute /
display some stuff differently in partials depending on the
context in which it appears.  For example, I have a _user_info
partial that appears in a sidebar, and also in the user page,
and I want to display some extra info in the second case. How
can I express that kind of conditions?  share|improve this
question add comment  4 Answers  up vote 2 down vote accepted
What you're asking for is something this:  if
params[:controller].eql?('users')   view code  However I would
split the partial into two separate partials and display the
distinct parts from whichever view you need.  share|improve this
answer Great, so I could just filter by controller or / and
action, right? –  agente_secreto Sep 17 '11 at 14:12 Yes, you
could condition however you want. –  mark Sep 17 '11 at 14:54
add comment  You can use controller_name and action_name
methods.  if controller_name == 'user' && action_name == 'show'
share|improve this answer add comment  Sure, it just