I am trying to set password with bcrypt-ruby and mongoid but whatever I
do I get "Password digest can't be blank".

# Model
class User
  include Mongoid::Document
  include Mongoid::Timestamps
  include ActiveModel::SecurePassword

  field :first_name,  type: String, default: ''
  field :last_name,   type: String, default: ''
  field :password_digest,  type: String

  has_secure_password
  attr_accessible :name, :password, :password_confirmation
end

# Form part
<tr><td class="dc-form-label">
  <label for="record_password">Password:</label></td>
  <td class="dc-form-field">
  <input id="record_password" type="password" size="20"
name="record[password]"></td>
</tr>

<tr>
  <td class="dc-form-label">
  <label for="record_password_confirmation">Password
confirmation:</label></td>
  <td class="dc-form-field">
  <input id="record_password_confirmation" type="password" size="20"
name="record[password_confirmation]"></td>
</tr>
-----------------------------
I have tried a lot. Funny thing is that editing or adding user with
rails console works OK.

One possible problem is that I have my own form system and I always use
name "record" for table name (instead of user in the case).

Help please.

by
TheR

-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to