active_model-session 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb37c5a803683c66784ff7c578a9fe27f9a5acb0
4
- data.tar.gz: bba585ddd3c4291d080970340d98d0a065b19614
3
+ metadata.gz: c5cd57a6ead747a4e20a597a5edc00a34492c079
4
+ data.tar.gz: bf772c5f0ce5b3d9c706a4c82a63f75518acdbb5
5
5
  SHA512:
6
- metadata.gz: a9d55f68eeca4e52360500aa64d522d55bab96ce624701f73938769d77b179550eaa19dbbe09591f22b9eb286fbd5cd85ccad671b7a7477ba14ac48537ac9cf2
7
- data.tar.gz: 96e740e67dc4da347a10ce1516b48708686ea1468309aa73f01bce4aa969b8ad2db87201c943853436603288d6c11232f89fd702b5e9f0b3eec119a814a3dcaa
6
+ metadata.gz: 1e36159deb0d78806505812cb335cd5d12a4da16c5576196edffe4e1a4e7859a6e6983a822729411d8c497cc0bbad60facf6c5b1adfb583ae458bf989b647e81
7
+ data.tar.gz: 869f0416c0eabf1808b95bfe78c4a1b4c30387b773c66e1441c9dd8d85663f0c404dc53b2941fc9312b7b52288456ebc0741ba78a3a1090c7e2559e88d7d10ce
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 Kuba Kuźma
1
+ Copyright (c) 2014 Kuba Kuźma
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ActiveModel::Session
2
2
 
3
- `ActiveModel::Session` is a lightweight session model implemented
3
+ `ActiveModel::Session` is a lightweight session model implemented
4
4
  on top of `ActiveModel::Model`.
5
5
 
6
6
  ## Installation
@@ -21,7 +21,7 @@ Or install it yourself as:
21
21
 
22
22
  The most popular workflow is:
23
23
 
24
- class SessionController < ApplicationController
24
+ class SessionsController < ApplicationController
25
25
  def new
26
26
  @session = ActiveModel::Session.new
27
27
  end
@@ -39,7 +39,7 @@ The most popular workflow is:
39
39
  private
40
40
 
41
41
  def session_params
42
- params.require(:session).permit(:email, :password)
42
+ params.require(:active_model_session).permit(:email, :password)
43
43
  end
44
44
  end
45
45
 
@@ -64,4 +64,4 @@ session model and override some defaults:
64
64
 
65
65
  ## Copyright
66
66
 
67
- Copyright © 2013 Kuba Kuźma. See LICENSE for details.
67
+ Copyright © 2014 Kuba Kuźma. See LICENSE for details.
@@ -5,7 +5,8 @@ module ActiveModel
5
5
  class Session
6
6
  include Model
7
7
 
8
- attr_accessor :password, :user
8
+ attr_accessor :password
9
+ attr_writer :user
9
10
  attr_reader :email
10
11
 
11
12
  validates :email, presence: true, if: -> { user.blank? }
@@ -14,7 +15,12 @@ module ActiveModel
14
15
  delegate :id, :authenticate, to: :user, prefix: true, allow_nil: true
15
16
 
16
17
  def email=(email)
18
+ remove_instance_variable(:@user) if defined?(@user)
17
19
  @email = email
20
+ end
21
+
22
+ def user
23
+ return @user if defined?(@user)
18
24
  @user = User.find_by(email: email)
19
25
  end
20
26
 
@@ -1,5 +1,5 @@
1
1
  module ActiveModel
2
2
  class Session
3
- VERSION = "1.0.2"
3
+ VERSION = "1.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_model-session
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kuba Kuźma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-31 00:00:00.000000000 Z
11
+ date: 2014-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel