Allow using Proc for :with_same option

I ran into a case where I needed choose the :with_same field based on
a state of an instance. The specific example was a model that belongs
a user but may also belong to a team. When it belongs to a team, it
should be ordered by the team_id, otherwise it should be ordered by
the user_id.

This commit allows handling this case in a pretty straigforward
manner. By using a Proc that takes the instance as a block argument,
we can dynamically choose the :with_same field based on the state of
the instance at rank-time.