Sha256: 2209254e4e504d510cfd0369f9a7871d9bbb6860def000fc1f0c3e5b2aa2af0f
Contents?: true
Size: 1.08 KB
Versions: 13
Compression:
Stored size: 1.08 KB
Contents
require 'active_model' # :nodoc: namespace module Authpwn # Included by the model class that collects signin information. # # Parts of the codebase assume the model will be named Session. module SessionModel extend ActiveSupport::Concern included do include ActiveModel::Model # The e-mail used to sign in. attr_accessor :email # The password used to sign in. attr_accessor :password end # Class methods on models that include Authpwn::SessionModel. module ClassMethods # Extracts signup information from a controller's params hash. # # @param [Hash] params the parameters received by a controller action # @return [Session] new Session instance containing the signup information def from_params(params) if params[:session] self.new email: params[:session][:email], password: params[:session][:password] else self.new email: params[:email], password: params[:password] end end end # module Authpwn::SessionModel::ClassMethods end # namespace Authpwn::SessionModel end # namespace Authpwn
Version data entries
13 entries across 13 versions & 1 rubygems