When a User create a new account on my app, I want to redirect him to another controller, lets say, a preferences controller.
But I don't know how to do it, the user is created, but it is not been redirect to the new page
Here is the create from user
def create
@user = User.new(params[:user])
if params[:user][:newMusician]
@user.preference = Preference.new
if @user.save
sign_in @user
flash[:success] = "Welcome"
redirect_to "/preference/edit/"
else
render 'new'
end
end
end
Here is my routes.rb
resources :users do
resources :preferences
Just to add, if the relation is has_one, should I still pluralize ? Because each user have just one preference
Another doubt, I just need the edit action in my preferences right ?
Thanks! (Rails 4 Ruby 2)