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

56 views
Skip to first unread message

Fernando Aureliano

unread,
Jun 11, 2011, 9:15:36 PM6/11/11
to rubyonra...@googlegroups.com
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!

--
Fernando Aureliano

Tim Shaffer

unread,
Jun 13, 2011, 1:35:01 PM6/13/11
to rubyonra...@googlegroups.com
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 %>

Fernando Aureliano

unread,
Jun 13, 2011, 7:42:41 PM6/13/11
to rubyonra...@googlegroups.com
Dont work.

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/M9XgyCg_Z8AJ.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.



--
Fernando Aureliano
--------------------------------------------------------------
[iOSDeveloper] - ObjectiveC
[WebDesigner] - CSS3&HTML5
[WebDeveloper] - RubyOnRails
--------------------------------------------------------------

Tim Shaffer

unread,
Jun 13, 2011, 9:27:54 PM6/13/11
to rubyonra...@googlegroups.com
Which part doesn't work?

Fernando Aureliano

unread,
Jun 13, 2011, 10:00:44 PM6/13/11
to rubyonra...@googlegroups.com
The form appears, I put the data and go!

Dont show any erros, but the data are not recorded

On Mon, Jun 13, 2011 at 10:27 PM, Tim Shaffer <timsh...@me.com> wrote:
Which part doesn't work?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/m5PzyPsORQ4J.

To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Colin Law

unread,
Jun 14, 2011, 3:37:44 AM6/14/11
to rubyonra...@googlegroups.com
On 14 June 2011 03:00, Fernando Aureliano <ma...@fernandoaureliano.com> wrote:
> 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

Fernando Aureliano

unread,
Jun 16, 2011, 3:52:10 PM6/16/11
to rubyonra...@googlegroups.com
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| %> 

  
  <p><%= f.label :email %><br />
  <%= f.email_field :email %></p>


  <p><%= f.label :password %><br />
  <%= f.password_field :password %></p>

  <p><%= f.label :password_confirmation %><br />
  <%= f.password_field :password_confirmation %></p>

  <p><%= f.submit "Sign up" %></p>
<% end %>


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.




--
Fernando Aureliano


Colin Law

unread,
Jun 16, 2011, 5:10:29 PM6/16/11
to rubyonra...@googlegroups.com
On 16 June 2011 20:52, Fernando Aureliano <ma...@fernandoaureliano.com> wrote:
> 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:

Fernando Aureliano

unread,
Jun 16, 2011, 5:42:41 PM6/16/11
to rubyonra...@googlegroups.com
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

Fernando Aureliano

unread,
Jun 16, 2011, 7:54:13 PM6/16/11
to rubyonra...@googlegroups.com
Yeah, finally I got the answer!


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"=>"fern...@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
Completed 302 Found in 119ms

Fernando Aureliano

unread,
Jun 16, 2011, 8:14:19 PM6/16/11
to rubyonra...@googlegroups.com
Ha!

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

But, how fix this?

Tim Shaffer

unread,
Jun 17, 2011, 10:59:22 AM6/17/11
to rubyonra...@googlegroups.com
On Thursday, June 16, 2011 8:14:19 PM UTC-4, Fernando Aureliano wrote:
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.
Reply all
Reply to author
Forward
0 new messages