All pastes #110525 Raw Edit

Untitled

public text v1 · immutable
·published 2006-08-01 19:07 UTC
rendered paste body
def user
  @user = User.new(params[:id])
  if @user.exists?
    if (params[:attrib].blank?)
      render_text @user.inspect.sort
    else
      if (@user.respond_to?(params[:attrib]))
        render_text @user.send(params[:attrib])
      else
        render_text 'Attribute does not exist.'
      end
    end
  else
    render_text 'User does not exist.'
  end  
end