def action_state(active, chosen = nil)
      active = active.is_a?(String) ? [active] : active
      chosen = chosen.is_a?(String) ? [chosen] : chosen

      if action_any_of?(*active)
        :active
      elsif !chosen.nil? && action_any_of?(*chosen) 
        :chosen
      else
        :inactive    
      end
    end
def action_state(active, chosen = nil)
      active = active.is_a?(String) ? [active] : active
      chosen = chosen.is_a?(String) ? [chosen] : chosen

      if action_any_of?(*active)
        :active
      elsif !chosen.nil? && action_any_of?(*chosen) 
        :chosen
      else
        :inactive    
      end
    end
Returns link state related to current controller and action: :inactive, :active or :chosen.
 A list of active actions is the first argument, chosen actions are the second argument.

 Examples:
   # :active for PostsController::index, :chosen for PostsController::* (except :index),
   # :inactive otherwise.
   action_state("posts#index", "posts#")

   # :active for PostsController::new and PostsController::create, :inactive otherwise.
   action_state(["posts#new", "posts#create"])

   # :active for PostsController::index, :chosen for MessagesController::* and
   # PostsController::* (except :index), :inactive otherwise.
   action_state("posts#index", ["posts#", "messages#"])