[LRUG] Form objects is Ruby

Kasper Grubbe kawsper at gmail.com
Fri Jul 24 04:28:11 PDT 2015


Yes :)

  def password=(password)
    self.password_digest = calculate_password_digest(password)
  end

  def password
    self.password_digest
  end

--
Kasper Grubbe

Phone: (+45) 42 42 42 74 or (+44) 77 07 12 17 81
Skype: kasper.grubbe
Mail: kaspergrubbe at gmail.com
Web: http://kaspergrubbe.dk

On Fri, Jul 24, 2015 at 12:17 PM, Michael Pavling <pavling at gmail.com> wrote:

> On 24 Jul 2015 11:20, "Kasper Grubbe" <kawsper at gmail.com> wrote:
> >
> > One of the purest forms of this that I have found is the
> "Password-change" use case. Because it deals with virtual fields as well.
> So lets say you have a User-model, and that model have a password-field
> that needs to be changed.
> >
> > The database would look like this:
> >
> > User
> >   id
> >   username
> >   password
> >
> > But what the user most often is presented with is these fields:
> >
> > Current password
> > New password
> > New password confirmation
> >
> > So you have a case where the interface doesn't match the structure of
> your database.
>
> Hopefully the database has "password_hash" or similar, rather than
> "password" ;-)
>
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> Archives: http://lists.lrug.org/pipermail/chat-lrug.org
> Manage your subscription: http://lists.lrug.org/options.cgi/chat-lrug.org
> List info: http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20150724/93f03e4e/attachment-0003.html>


More information about the Chat mailing list