notifiable-rails 0.19.7 → 0.19.9

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: e4930be4cd8d3300c6a173b42554d69b162e377a
4
- data.tar.gz: 2bb247ae94466a6964128e30807fd7265d5428f6
3
+ metadata.gz: d72a8ab45299096c3999b1f5b4636711f3abc436
4
+ data.tar.gz: a5c5d447002f2b6467142e0a26ee44e95f99033f
5
5
  SHA512:
6
- metadata.gz: 117e488531bfc1b478346e156d3054ae6ad832ec5a63dde15bbdf833208b044989d55a1c81b329a8b6d5c3357d9ac7be3e65427b9104ed36dba11b092082d4eb
7
- data.tar.gz: e92dd6a05a15a25bff83a0a42bbe2b94f17029721d32d0d92eba64c9eb6c60a529935ea96da4af458328ba28e2e5fbb699abc8fcf3ca5b0ce80f18d8054ff122
6
+ metadata.gz: 53bdb4ced5e11d073810bff0d408d69e7ef46ca0ae7c2fbc7295f48687d7a2eb3089aca448434680595e857862533d802907b8293cdbbe9786b0f9eec8fa1b34
7
+ data.tar.gz: 06bba839f81ee6e931fce417febaf9c55c63e87abba3fae279ab232b5fd05f43ac716d937fbe1aa821c6b781af3c9a3ac6cacb558da229557338376dce8c3989
@@ -10,9 +10,8 @@ module Notifiable
10
10
  before_filter :find_device_token, :ensure_authorized!, :except => :create
11
11
 
12
12
  def create
13
- @device_token = DeviceToken.find_by(:token => params[:token], :is_valid => true)
14
- @device_token = DeviceToken.new unless @device_token
15
-
13
+ @device_token = DeviceToken.find_or_initialize_by(:token => params[:token])
14
+ @device_token.is_valid = true
16
15
  perform_update(device_token_params)
17
16
  end
18
17
 
@@ -50,7 +49,7 @@ module Notifiable
50
49
  end
51
50
 
52
51
  def ensure_authorized!
53
- head :status => :unauthorized if @device_token.user && !@device_token.user.eql?(current_notifiable_user)
52
+ head :status => :unauthorized if @device_token.user && current_notifiable_user && !@device_token.user.eql?(current_notifiable_user)
54
53
  end
55
54
 
56
55
  def find_device_token
@@ -10,6 +10,12 @@ module Notifiable
10
10
  g.helper false
11
11
  end
12
12
 
13
+ # load decorators
14
+ config.to_prepare do
15
+ Dir.glob(Rails.root + "app/decorators/**/*_decorator*.rb").each do |c|
16
+ require_dependency(c)
17
+ end
18
+ end
13
19
  end
14
20
 
15
21
  end
@@ -1,3 +1,3 @@
1
1
  module Notifiable
2
- VERSION = "0.19.7"
2
+ VERSION = "0.19.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notifiable-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.7
4
+ version: 0.19.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kamil Kocemba
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-22 00:00:00.000000000 Z
12
+ date: 2014-12-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - '>='
19
19
  - !ruby/object:Gem::Version
20
- version: 4.0.0
20
+ version: '0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - '>='
26
26
  - !ruby/object:Gem::Version
27
- version: 4.0.0
27
+ version: '0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rspec-rails
30
30
  requirement: !ruby/object:Gem::Requirement