Can a Rails controller action handle both html and javascript requests?
===

I have a link that allows users to claim fictional locations in my app, via the link

    <%= link_to("Claim this location!", loc_claim_path(@loc.id), :id => "loc_claim") %>

It routes the request through my claim controller, like such:

    def claim

  	    @loc = Location.find(params[:loc_id])

  	    if !@user
	        flash[:notice] = "You need to be logged in to claim a location!"
	        redirect_to(@loc)
  	    else
            flash[:notice] = "Location claimed!"
            render("claim.js")
  	    end

    end

If a user isn't logged in (that is @user is false), it redirects them back to the location page.

However, if a user is logged in, then it needs to fire the javascript claim.js, which then also redirects back to the location page when finished.

My problem is, if set :remote => true, it will launch the javascript, but not the html, and vice versa when I don't set :remote.

Is there a way for me to have the best of both worlds? Or, barring that, is there a better way to set this up?