rails_temporary_data 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -6,6 +6,7 @@ Rails engine to simply save big temporary data (too big for session cookie store
6
6
  Why
7
7
  ---
8
8
  While working on [Padbase](http://www.padbase.com) we needed [2 steps signup process](http://www.padbase.com/pads/new) (1. enter property info, 2. enter user info). Info entered in first step could get very large and we couldn't save it in a session because of [CookieOverflow](http://api.rubyonrails.org/classes/ActionDispatch/Cookies/CookieOverflow.html), didn't want to switch to ActiveRecord store and didn't want to save invalid property in database with the flag (partial validations, ...). Solution was to create separate table for this temporary data and RailsTemporaryData was born.
9
+
9
10
  **This way you get best from both worlds. Standard session data is still saved in a cookie and you can save larger amount of data in a database.**
10
11
 
11
12
  Install
@@ -13,7 +14,7 @@ Install
13
14
 
14
15
  Start by adding the gem to your application's Gemfile
15
16
 
16
- gem 'rails_temporary_data', :git => 'git://github.com/vlado/rails_temporary_data.git'
17
+ gem 'rails_temporary_data'
17
18
 
18
19
  Update your bundle
19
20
 
@@ -30,48 +31,48 @@ Run migration
30
31
  Example
31
32
  --------
32
33
 
33
- class DummyController < ApplicationController
34
+ class DummyController < ApplicationController
34
35
 
35
- def set_data
36
- set_tmp_data("some_key", { first_name: "Vlado", last_name: "Cingel", bio: "Very ... very long bio" })
37
- ...
38
- end
36
+ def set_data
37
+ set_tmp_data("some_key", { first_name: "Vlado", last_name: "Cingel", bio: "Very ... very long bio" })
38
+ ...
39
+ end
39
40
 
40
- def get_data
41
- tmp_data = get_tmp_data("some_key").data
42
- # do something with tmp data
43
- first_name = tmp_data[:first_name] # => Vlado
44
- ...
45
- end
41
+ def get_data
42
+ tmp_data = get_tmp_data("some_key").data
43
+ # do something with tmp data
44
+ first_name = tmp_data[:first_name] # => Vlado
45
+ ...
46
+ end
46
47
 
47
- end
48
+ end
48
49
 
49
50
  You can optionally set data expiry time (default is 2 days)
50
51
 
51
- class DummyController < ApplicationController
52
+ class DummyController < ApplicationController
52
53
 
53
- def set_data
54
- set_tmp_data("some_key", { first_name: "Vlado", last_name: "Cingel", bio: "Very ... very long bio" }, Time.now + 3.days)
55
- ...
56
- end
54
+ def set_data
55
+ set_tmp_data("some_key", { bio: "Very ... very long bio" }, Time.now + 3.days)
56
+ ...
57
+ end
57
58
 
58
- end
59
+ end
59
60
 
60
61
  To clear data you don't need any more
61
62
 
62
- class DummyController < ApplicationController
63
+ class DummyController < ApplicationController
63
64
 
64
- def get_data
65
- tmp_data = get_tmp_data("some_key").data
66
- # do something with tmp data
67
- clear_tmp_data("some_key")
68
- end
65
+ def get_data
66
+ tmp_data = get_tmp_data("some_key").data
67
+ # do something with tmp data
68
+ clear_tmp_data("some_key")
69
+ end
69
70
 
70
- end
71
+ end
71
72
 
72
73
  To help you clear unwanted and/or expired data rake task is provided. You should set a cron job to call this task daily.
73
74
 
74
- rake rails_temporary_data:delete_expired
75
+ rake rails_temporary_data:delete_expired
75
76
 
76
77
 
77
78
  TODO
@@ -1,3 +1,3 @@
1
1
  module RailsTemporaryData
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.version = RailsTemporaryData::VERSION
8
8
  s.authors = ["Vlado Cingel"]
9
9
  s.email = ["vladocingel@gmail.com"]
10
- s.homepage = ""
10
+ s.homepage = "https://github.com/vlado/rails_temporary_data"
11
11
  s.summary = %q{Rails engine to simply save temporary data that is too big for session in database}
12
12
  s.description = %q{Rails engine to simply save temporary data that is too big for session in database}
13
13
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_temporary_data
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 0
10
- version: 1.0.0
9
+ - 1
10
+ version: 1.0.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Vlado Cingel
@@ -112,7 +112,7 @@ files:
112
112
  - test/dummy_rails_app/public/stylesheets/.gitkeep
113
113
  - test/temporary_data_test.rb
114
114
  - test/test_helper.rb
115
- homepage: ""
115
+ homepage: https://github.com/vlado/rails_temporary_data
116
116
  licenses: []
117
117
 
118
118
  post_install_message: