ruby on rails: how to change the routing address -


I am new to the rail and I would like to know that if there is any way to change the names of the routes, I will be punished in one minute. I will explain I have named a Administrator users_controller and below is the code that is in my controller:

  if def can create @ User.save redirect_to @user end  

and my routes.rb file is given below:

  Resources: Users For '/ user / receive: ID': 'user #show'  

Now assume that I have a form and I fill it correctly if I Localhost: 3000 / users / id (id = some value) < / Code> What I do now I want this URL like localhost: 3000 / registered . This is when I click the submit button and if everything is correct then I should see the URL as localhost: 3000 / registered which shows me my show action or that just works like localhost: 3000 / user / id (id = some value) . I do not want that ID to be visible.

For this, I tried get 'registered', to: 'users # show' but still me localhost: 3000 / users / id (id = some value ) . Please tell me how to do this.

And here my show action

  def show user @ user.fund (para [id])  

I tried another way by another action in another controller I made my users_controller in index action and then executed I did not find a any method error

class = "post-text" itemprop = "text">

just use your routing Type:

  match "/ registered" ,: to = & gt; "User #subscribe" ,::like = & gt; : User_registered, via :: use this path to get  

to

  redirect_to user_registered_path (id: user_id)  

In your method


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

lua - HowTo create a fuel bar -