Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7679391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:52:01+00:00 2026-05-31T17:52:01+00:00

def new @title = Create a user @user = User.new end <%= form_for(@user) do

  • 0
def new
     @title = "Create a user"
     @user = User.new
end

<%= form_for(@user) do |f| %>
  <div class="field">
    <%= f.label :email %><br />
    <%= f.email_field :email%>
  </div>
  <div class="field">
    <%= f.label :password %><br />
    <%= f.password_field :password %>
  </div>
  <div class="field">
    <%= f.label :password_confirmation, "Confirmation" %><br />
    <%= f.password_field :password_confirmation %>
  </div>
  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>

when i try submit my form to create a new user, i get a message “You are already signed in.” and the user does not get created what could be the problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T17:52:02+00:00Added an answer on May 31, 2026 at 5:52 pm

    As mentioned in my comment you have to tell Devise you want to use a custom controller for registrations, so it knows not to use it’s default behaviour.

    Since you want to restrict users from registering publicly, I think (I didn’t test this) you have to create your own custom registrations controller, which does the same thing as devise defaults one, except only if a user is already logged in… I’m not sure though what exactly happens after the (not public) registration is finished. Cause Devise tries to log you in automatically – depending if you’re using confirmable or not… But my guess would be that you get logged out as the old user and logged in as the new one…

    So to give you directions you should read the README section concerning Configuring Controllers.
    And then you could try simply to add a the before_filter to authenticate a user in your custom registrations controller (assuming your user model is called User):

    class MyRegistrationsController < Devise::RegistrationsController
      before_filter :authenticate_user!
    end
    

    But again. I didn’t test this… so maybe it’s not the way to do it, but it’s worth a try 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

class Hello @hello = hello def display puts @hello end end h = Hello.new
new.html.erb <h3>Add post</h3> <%= form_tag :controller=>'posts', :action=>'create' do %> <%= label :q, :Title %>
I am doing something like this: class Class(object): def __init__(self): self.var=#new instance name string#
I have this code: def setVelocity (x, y, yaw) setVelocity (Command2d.new(x,y,yaw)) end def setVelocity
I have the following code: #!/usr/bin/ruby class Person def self.speak p = self.new puts
def create @addpost = Post.new params[:data] if @addpost.save flash[:notice] = Post has been saved
I want to create a new user from my form in my new.html.erb file:
I have a __new__ method as follows: class MyClass(object): def __new__(cls, *args): new_args =
I am trying to write a decorator to do logging: def logger(myFunc): def new(*args,
def sss(request): handle=open('b.txt','r+') handle.write(I AM NEW FILE) var=handle.read(); return HttpResponse(var) urlpatterns = patterns('', ('^$',sss),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.