Ruby on Rails redirect_to arguments

There is always black magic in Rails, and I cannot find documentation to help me figure this out. What redirect_to does is clearly straightforward. Actually, this question is not even directly related, but the argument I see is passed to redirect_to often and cannot understand where this argument comes from. For example, if you create a new object, say, “user”, you will see the following code in user_controller.rb:

  def destroy
    @user = User.find(params[:id])
    @user.destroy

    respond_to do |format|
      format.html { redirect_to(users_url) }
      format.xml  { head :ok }
    end
  end

The question is what exactly is user_url here? Where is it from? Can someone point me in the right direction as far as the documentation goes?

+5
source share
2 answers

users_url URL- . Rails action_dispatch . , .

+1

, Rails , , . , rake routes. edit_user, user new_user. _url , URL-. URL- - , redirect_to.

+3

All Articles