Here's what I've (re)learned after a few hours poking at Sequel and
ActiveModel::SecurePassword.has_secure_password
In olden times (pre-AM 4.3?) I seem to recall that there were more than one ActiveModel
module that needed to be included in a
non-ActiveRecord::Base
subclass to get it to meet requirements for has_secure_password
. That has now been reduced to one (meta-)module.
For example, see the below user.rb
file. All you need is include ActiveModel::SecurePassword
, apparently.
I"m still using ActiveRecord for generating models, migrations and such (sequel-rails
has repeatedly and consistently broken my app in ways I've chosen to defer figuring out fixes for), but the Rails 4.3 generator has a few
Useful Tricks I don't remember from 4.2. The command line I used to generate the migration I wanted was
bundle exec rails g model user pen_name:string:uniq password:digest email:string:index profile:text
My notes from previous apps indicate that I'd previously used the field declaration password_digest:string
rather than password:digest
.
Arguably easier to type, and virtually inarguably more intention-revealing. Very nice.
Simply as a mea culpa to the folks I pestered on the Google+ Ruby community, and hopefully to make it less likely for the next sad sack to dine on his foot as energetically as I did today.