ruby on rails - Devise - Error message not showing up - redirects to update instead of create -


i've on written registration controller , i'm trying return form create user, works partly.

def create   u = user.find_by_email(params[:user][:email])   ...   if u && u.unregistered     self.resource = u     if resource.update_with_password(params[resource_name])       ...       set_flash_message :notice, :updated if is_navigational_format?       ...       sign_in(resource_name, resource)       if u.confirmed?         redirect_to consultations_path       else         redirect_to send_advisor_confirmation_path(u.id)       end      else       clean_up_passwords(resource)       # place has problem       respond_with_navigational(resource) { render_with_scope :new }     end     return   end   super end 

(side note: in app possible create user hasn't signed in yet, defined being "unregistered", , can claim account going through sign process).

this respond_with_navigational works first time (when new posting create) when mess form again clears whole form (when create posting create... or should be). logs first time going create, second time going update:

started post "/users" 127.0.0.1 @ 2011-07-20 15:49:30 -0500   processing registrationscontroller#create html ... started post "/users" 127.0.0.1 @ 2011-07-20 15:50:56 -0500   processing registrationscontroller#update html 

according routes (rake routes):

          post   /users(.:format)             {:action=>"create", :controller=>"users"}  new_user    /users/new(.:format)         {:action=>"new", :controller=>"users"} edit_user    /users/:id/edit(.:format)    {:action=>"edit", :controller=>"users"}      user    /users/:id(.:format)         {:action=>"show", :controller=>"users"}           put    /users/:id(.:format)         {:action=>"update", :controller=>"users"} 

so why send post directed update? , how can fix this?

update: ok, being redirected update (i believe) because resource being defined existing object. because have custom strategy devise saying particular user isn't authenticated, unable go update (which requires authentication) , redirected new, without parameters.

so question becomes, how setup resource looks new user, has errors has before creating new user.

for example error might "passwords not matching", if find errors on new user "email taken".

edit 1: missed of question, may not helpful.

make sure you're using display on page:

layouts/application.html.erb (or wherever need it)

<p class="notice"><%= notice %></p> <p class="alert"><%= alert %></p> 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -