## app/controllers/users_controller.rb
# In your controller parse a "size" parameter
class UsersController < ApplicationController
def show
@user = User.find(params[:id])
@size = params[:size] == 'original' ? 'original' : 'small'
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @user }
end
end
end
## app/views/users/show.html.erb
# In your view, display the appropriate size, and a link somewhere to the other size.
# You need "to_sym" since Paperclip expects a symbol... :original, not 'original'
<p>
<b>Avatar:</b>
<%= image_tag @user.avatar.url(@size.to_sym) %><br>
</p>
<%= link_to_other_size(@size) %>
## app/helpers/users_helper.rb
# Hide your logic for getting the "other size" link in a helper method:
module UsersHelper
def link_to_other_size(size)
case size
when 'small'
other_size = 'original'
else
other_size = 'small'
end
link_to link_name_for_size(other_size), :size => other_size
end
def link_name_for_size(size)
"#{size.capitalize} Size"
end
end