MID
MID

Reputation: 1825

How to redirect user to edit page after creation?

I'm a little bit confused - when user creation is successful.

I can call ( working )

if @wibiya_user.save
 render :edit
end

but why when I write

   if @wibiya_user.save
       format.html { redirect_to edit_wibiya_user_path(@wibiya_user) }
   end

I get Routing error:

No route matches {:action=>"edit", :controller=>"wibiya_users"}

However I do have in my routes:

     resources :wibiya_users
 ...
rake routes
  edit_wibiya_user GET    /wibiya_users/:id/edit(.:format) wibiya_users#edit

Why it is happening like that ?

Upvotes: 0

Views: 137

Answers (1)

Michael Durrant
Michael Durrant

Reputation: 96484

Change your users controller (filename, class name, redirects, etc.) to be a WibiyaUsersController.

Explanation: The resources :wilibya_user in your routes.rb file sets up the various routes for that resource. It assumes the controller is called wibiya_users_controller

Upvotes: 1

Related Questions