Active Cards Models
Idea
+status
+priority
+issues
Thinking about moving the User model into cards, and that it is part of a larger pattern. What we want is to add a class, probably a Card subclass, that defines a group of specific "attributes" as "the contents of plus cards.
+solution
Maybe something like this:
class User < Card
card_defaults :type=>Card::Phrase
card_attribute :email, :status, :crypted_password, :salt, :password_reset_code
card_attribute :invite_sender, :type => Card::PointerID
inherited_attribute :email, :status
# then expect to be able to use AR methods as if these are regular AR attributes
attr_accessor :password, :name
validates :email, :presence=>true, :if=>:email_required?,
:uniqueness => { :scope => :login },
:format => { :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i },
:length => { :maximum => 100 }
:id, :presence=>true, :confirmation=>true, :if=>:password_required?,
:length => { :within => 5..40 }
validates :password_confirmation, :presence=>true, :if=>:password_required?
before_validation :downcase_email!
before_save :encrypt_password
end
Connect up the new events to save these values in the contents of the plus cards.
+discussed in support tickets
+relevant user stories