Why the URL helper on rails puts ".". instead of "/" on the way?

In my application, I am working to allow users to send invitations. Invitations have tokens. And in the letters, I link to the registration page with a token in transit. In the mail controller, I use:

new_user_registration_url(@invitation.token)

as I saw Ryan Bates in this railscast . But it outputs this format:

http://localhost:3000/signup.4a4aebcde29738a39c7f447f58817e49cf9b4cf4

Why there is a "." instead of "/"?

Update:

I am using the program, and here are the relevant routes. I am not so sure about this; I struggled a bit with this, but they seemed to work:

  devise_scope :user do
    get '/signup/:invitation_token' => "registrations#new", :as => :new_user_registration
  end
  devise_for :users, :controllers => { :registrations => "registrations"}, :skip => [:registrations]
  as :user do
    get '/users/cancel' => 'devise/registrations#cancel', :as => :cancel_user_registration
    post '/users' => 'devise/registrations#create', :as => :user_registration
    get '/signup' => 'registrations#new', :as => :new_user_registration
    get '/users/edit' => 'devise/registrations#edit', :as => :edit_user_registration
    put '/users' => 'devise/registrations#update'
    delete '/users' => 'devise/registrations#destroy'
  end
+3
source share
2 answers

Wihout is routes.rbhard to say, but it seems the author has something like:

#in routes.rb
get 'signup' => 'controller#action', as: :new_user_registration

but must have:

get 'signup/:token' => 'controller#action', as: :new_user_registration

Verification:

# in console
app.new_user_registration_path('ToKeN') # => "/signup/ToKeN"
+3

, , format. :

new_user_registration_url(:token => @invitation.token)

new_user_registration_url + "/" + @invitation.token
0

All Articles