[Devise] Display a custom sign_UP form anywhere in your app

Hi!

I know how to display an sign_in form, but now, i’d like to display a sign_up form in another place of my application.

Have some way to do this?

I can’t find nothing about that on the documentation

thanks!

Same way you’d display the form any other place I’d imagine…

<%= form_for(User.new, :as => :user, :url => registration_path(:user)) do |f| %>

<%= devise_error_messages! %>
  form fields here...

<%= f.submit "Sign up" %>

<% end %>

Dont work.

maybe because I’m already logged in when I try a new register?

Which part doesn’t work?

The form appears, I put the data and go!

Dont show any erros, but the data are not recorded

Have a look in development.log to check that the data are being posted
correctly and it is going to the correct action. Then if all looks ok
use ruby-debug to break into your code and see what is going on. Have
a look at the Rails Guide on debugging to find how to do this.

Colin

I can get the form in another view with the code below.

But when insert the data and submit, the user is not recorded in database

<%= form_for(User.new, :as => :user, :url => registration_path(:user)) do |f| %>

<%= f.label :email %>

<%= f.email_field :email %>

<%= f.label :password %>

<%= f.password_field :password %>

<%= f.label :password_confirmation %>

<%= f.password_field :password_confirmation %>

<%= f.submit "Sign up" %>

<% end %>

I can get the form in another view with the code below.
But when insert the data and submit, the user is not recorded in database

I can only repeat my previous post exactly:
Have a look in development.log to check that the data are being posted
correctly and it is going to the correct action. Then if all looks ok
use ruby-debug to break into your code and see what is going on. Have
a look at the Rails Guide on debugging to find how to do this.

Colin

Hi!

First user (admin) I already register.

It’s a security question. If I leave the registration page open, everyone can find that and register yourself on admin, and have access…

=D

Yeah, finally I got the answer!

http://stackoverflow.com/questions/6376718/devise-display-a-custom-sign-up-form-anywhere-in-your-app

But, for some reason, when I registered an user, he’s not recorded on db. But the terminal see the data correctly =/

In the terminal, I see the data, but the record its not happening. Oo

Started POST “/users” for 127.0.0.1 at 2011-06-16 20:13:33 -0300

Processing by Devise::RegistrationsController#create as HTML

Parameters: {“utf8”=>“✓”, “authenticity_token”=>“ULeV0DeOgB+Ss2qD43to/TifRfGlHxcGhJ6XDDNviBo=”, “user”=>{“nome”=>“fsdasdf”, “sobrenome”=>“fasdf”, “email”=>“fernando@dz3.com.br”, “tipo”=>“Distribuidores”, “password”=>"[FILTERED]", “password_confirmation”=>"[FILTERED]"}, “commit”=>“Sign up”}

User Load (1.0ms) SELECT “users”.* FROM “users” WHERE “users”.“id” = 1 LIMIT 1

Redirected to http://localhost:3000/admin

Completed 302 Found in 119ms

Ha!

I found a problem. The problem is because I try to register a user while I’m logged on

But, how fix this?

Don’t register a user while you’re logged in.