Note that there are some explanatory texts on larger screens.

plurals
  1. POROR Devise "Email can't be blank" Error
    text
    copied!<p>I am following a tutorial to setup a prelaunch page using Devise to manage collecting user emails. when I enter an email address i get error message "1 error prohibited this user from being saved:Email can't be blank" My users model:</p> <pre><code>class User &lt; ActiveRecord::Base rolify # Include default devise modules. Others available are: # :token_authenticatable, :encryptable, :confirmable, :lockable :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :confirmable, :recoverable, :rememberable, :trackable, :validatable # Setup accessible (or protected) attributes for your model attr_accessible :name, :email, :password, :password_confirmation, :remember_me after_create :add_user_to_mailchimp before_destroy :remove_user_from_mailchimp # override Devise method # no password is required when the account is created; validate password when the user sets one validates_confirmation_of :password def password_required? if !persisted? !(password != "") else !password.nil? || !password_confirmation.nil? end end # override Devise method def confirmation_required? false end # override Devise method def active_for_authentication? confirmed? || confirmation_period_valid? end def send_reset_password_instructions if self.confirmed? super else errors.add :base, "You must receive an invitation before you set your password." end end # new function to set the password def attempt_set_password(params) p = {} p[:password] = params[:password] p[:password_confirmation] = params[:password_confirmation] update_attributes(p) end # new function to determine whether a password has been set def has_no_password? self.encrypted_password.blank? end # new function to provide access to protected method pending_any_confirmation def only_if_unconfirmed pending_any_confirmation {yield} end </code></pre> <p>my users controller:</p> <pre><code>before_filter :authenticate_user! def index authorize! :index, @user, :message =&gt; 'Not authorized as an administrator.' @users = User.all end def show @user = User.find(params[:id]) end def update authorize! :update, @user, :message =&gt; 'Not authorized as an administrator.' @user = User.find(params[:id]) if @user.update_attributes(params[:user], :as =&gt; :admin) redirect_to users_path, :notice =&gt; "User updated." else redirect_to users_path, :alert =&gt; "Unable to update user." end end def destroy authorize! :destroy, @user, :message =&gt; 'Not authorized as an administrator.' user = User.find(params[:id]) unless user == current_user user.destroy redirect_to users_path, :notice =&gt; "User deleted." else redirect_to users_path, :notice =&gt; "Can't delete yourself." end end </code></pre> <p>Devise/Registrations/new view </p> <pre><code>&lt;div class="email-capture"&gt; &lt;%=form_for(resource, :as =&gt; resource_name, :url =&gt; registration_path(resource_name)) do |f| %&gt; &lt;%= devise_error_messages! %&gt; &lt;%= f.text_field :email, :class=&gt;"email"%&gt; &lt;%= f.submit " ", :class=&gt;"reg-btn"%&gt; &lt;% end %&gt; &lt;/div&gt; </code></pre> <p>Log message after i click submit</p> <pre><code>Started POST "/users" for 127.0.0.1 at 2013-12-02 10:36:11 -0500 Processing by RegistrationsController#create as HTML Parameters: {"utf8"=&gt;"√", "authenticity_token"=&gt;"mytoken", "user"=&gt; {"email"=&gt;"test@email.com"}, "commit"=&gt;" "} ←[1m←[36m (0.0ms)←[0m ←[1mbegin transaction←[0m ←[1m←[35m (0.0ms)←[0m rollback transaction Rendered devise/registrations/new.html.erb within layouts/application (5.0ms) Rendered layouts/_messages.html.erb (0.0ms) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload