title: Devise:: Cannot create user through rake db:seed (failure confirmation_instructions)
body: <p>User model has a function</p>
  
  <pre><code>def self.createadmin(
  User.create(:email =&gt; "abc@gmail.com", :password =&gt; "123456e", :password_confirmation =&gt; "123456e", :terms_of_service =&gt; '1')
  end
  </code></pre>
  
  <p>In rake db:seed, I have to call User.createadmin</p>
  
  <p>However, this fails </p>
  
  <pre><code>ActionView::Template::Error: ActionView::Template::Error
      from /Users/bever/Projects/tr/app/views/devise/mailer/confirmation_instructions.html.erb:3:in `_app_views_devise_mailer_confirmation_instructions_html_erb___1974818942364630283_2154906860'
  </code></pre>
  
  <p>Then I changed the code in createadmin</p>
  
  <pre><code>begin
  User.create(:email =&gt; "abc@gmail.com", :password =&gt; "123456e", :password_confirmation =&gt; "123456e", :terms_of_service =&gt; '1')
  rescue =&gt; e
  User.create(:email =&gt; "abc@gmail.com", :password =&gt; "123456e", :password_confirmation =&gt; "123456e", :terms_of_service =&gt; '1')
  end    
  </code></pre>
  
  <p>It works! Any clue why this is happening?</p>