has_serialized 0.1.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ *.swp
2
+ **/*.swp
3
+ db
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-1.9.3-p429
data/CHANGELOG ADDED
@@ -0,0 +1,4 @@
1
+ # 1.0.0
2
+
3
+ - Drop support for Ruby 1.8.7
4
+ - Clean up gemspec and Gemfile
data/Gemfile CHANGED
@@ -1,16 +1,3 @@
1
1
  source "http://rubygems.org"
2
- # Add dependencies required to use your gem here.
3
- # Example:
4
- gem "activerecord", "~> 3.1.0.rc"
5
- # Add dependencies to develop your gem here.
6
- # Include everything needed to run rake, tests, features, etc.
7
- group :development do
8
- gem "rspec", "~> 2.6.0"
9
- gem "bundler", "~> 1.0.0"
10
- gem "jeweler", "~> 1.5.2"
11
- gem "rcov", ">= 0"
12
- gem "guard-rspec"
13
- gem "libnotify"
14
- gem "sqlite3"
15
- gem "arel", "2.1.4"
16
- end
2
+
3
+ gemspec
data/Gemfile.lock CHANGED
@@ -1,60 +1,51 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ has_serialized (1.0.0)
5
+ activerecord (>= 3.0.0)
6
+
1
7
  GEM
2
8
  remote: http://rubygems.org/
3
9
  specs:
4
- activemodel (3.1.0.rc5)
5
- activesupport (= 3.1.0.rc5)
6
- bcrypt-ruby (~> 2.1.4)
7
- builder (~> 3.0.0)
8
- i18n (~> 0.6)
9
- activerecord (3.1.0.rc5)
10
- activemodel (= 3.1.0.rc5)
11
- activesupport (= 3.1.0.rc5)
12
- arel (~> 2.1.4)
13
- tzinfo (~> 0.3.29)
14
- activesupport (3.1.0.rc5)
15
- multi_json (~> 1.0)
16
- arel (2.1.4)
17
- bcrypt-ruby (2.1.4)
18
- builder (3.0.0)
19
- diff-lcs (1.1.2)
20
- ffi (1.0.9)
21
- git (1.2.5)
22
- guard (0.3.4)
23
- thor (~> 0.14.6)
24
- guard-rspec (0.3.1)
25
- guard (>= 0.2.2)
26
- i18n (0.6.0)
27
- jeweler (1.5.2)
28
- bundler (~> 1.0.0)
29
- git (>= 1.2.5)
30
- rake
31
- libnotify (0.5.1)
32
- ffi (~> 1.0)
33
- multi_json (1.0.3)
34
- rake (0.8.7)
35
- rcov (0.9.9)
36
- rspec (2.6.0)
37
- rspec-core (~> 2.6.0)
38
- rspec-expectations (~> 2.6.0)
39
- rspec-mocks (~> 2.6.0)
40
- rspec-core (2.6.4)
41
- rspec-expectations (2.6.0)
42
- diff-lcs (~> 1.1.2)
43
- rspec-mocks (2.6.0)
44
- sqlite3 (1.3.3)
45
- thor (0.14.6)
46
- tzinfo (0.3.29)
10
+ activemodel (4.0.0)
11
+ activesupport (= 4.0.0)
12
+ builder (~> 3.1.0)
13
+ activerecord (4.0.0)
14
+ activemodel (= 4.0.0)
15
+ activerecord-deprecated_finders (~> 1.0.2)
16
+ activesupport (= 4.0.0)
17
+ arel (~> 4.0.0)
18
+ activerecord-deprecated_finders (1.0.3)
19
+ activesupport (4.0.0)
20
+ i18n (~> 0.6, >= 0.6.4)
21
+ minitest (~> 4.2)
22
+ multi_json (~> 1.3)
23
+ thread_safe (~> 0.1)
24
+ tzinfo (~> 0.3.37)
25
+ arel (4.0.0)
26
+ atomic (1.1.12)
27
+ builder (3.1.4)
28
+ diff-lcs (1.2.4)
29
+ i18n (0.6.4)
30
+ minitest (4.7.5)
31
+ multi_json (1.7.8)
32
+ rspec (2.14.1)
33
+ rspec-core (~> 2.14.0)
34
+ rspec-expectations (~> 2.14.0)
35
+ rspec-mocks (~> 2.14.0)
36
+ rspec-core (2.14.4)
37
+ rspec-expectations (2.14.0)
38
+ diff-lcs (>= 1.1.3, < 2.0)
39
+ rspec-mocks (2.14.2)
40
+ sqlite3 (1.3.7)
41
+ thread_safe (0.1.2)
42
+ atomic
43
+ tzinfo (0.3.37)
47
44
 
48
45
  PLATFORMS
49
46
  ruby
50
47
 
51
48
  DEPENDENCIES
52
- activerecord (~> 3.1.0.rc)
53
- arel (= 2.1.4)
54
- bundler (~> 1.0.0)
55
- guard-rspec
56
- jeweler (~> 1.5.2)
57
- libnotify
58
- rcov
59
- rspec (~> 2.6.0)
49
+ has_serialized!
50
+ rspec
60
51
  sqlite3
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # AttributeSerializer
2
+
3
+ Based on the [Attribute Serializer article written by Greg Moreno](http://gregmoreno.ca/preventing-model-explosion-via-rails-serialization/)
4
+
5
+ ## Example
6
+
7
+ class User < ActiveRecord::Base
8
+ has_serialized :preferences, :show_email => false, :locale => :en
9
+ end
10
+
11
+ u = User.new # automatically assigns the default preferences
12
+ u.preferences
13
+ => {:show_email => false, :locale => :en}
14
+
15
+ u.show_email = true # I can change it like an attribute via @user.update_attributes(params[:user])
16
+ u.preferences
17
+ => {:show_email => true, :locale => :en }
18
+
19
+ u.show_email # true
20
+
21
+ ## Specs
22
+
23
+ Run specs through `rspec spec`
24
+
25
+ ## Contributing to has\_serialized
26
+
27
+ - Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
28
+ - Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
29
+ - Fork the project
30
+ - Start a feature/bugfix branch
31
+ - Commit and push until you are happy with your contribution
32
+ - Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
33
+ - Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
34
+
35
+ Copyright (c) 2013 Greg Moreno, Adam Cuppy and Ramon Tayag. Released under the MIT license
data/Rakefile CHANGED
@@ -1,50 +1,7 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
10
- require 'rake'
11
-
12
- require 'jeweler'
13
- Jeweler::Tasks.new do |gem|
14
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
- gem.name = "has_serialized"
16
- gem.homepage = "http://github.com/ramontayag/has_serialized"
17
- gem.license = "MIT"
18
- gem.description = %q{Adds dynamic attributes through serialize. This way, it's in one table, and it's still trivial to track changes to your records.}
19
- gem.summary = %Q{Adds dynamic attributes through serialize.}
20
- gem.email = "ramon@tayag.net"
21
- gem.authors = ["Ramon Tayag"]
22
- # Include your dependencies below. Runtime dependencies are required when using your gem,
23
- # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
24
- # gem.add_runtime_dependency 'jabber4r', '> 0.1'
25
- # gem.add_development_dependency 'rspec', '> 1.2.3'
26
- end
27
- Jeweler::RubygemsDotOrgTasks.new
1
+ require "bundler/gem_tasks"
28
2
 
29
3
  require 'rspec/core'
30
4
  require 'rspec/core/rake_task'
31
5
  RSpec::Core::RakeTask.new(:spec) do |spec|
32
6
  spec.pattern = FileList['spec/**/*_spec.rb']
33
7
  end
34
-
35
- RSpec::Core::RakeTask.new(:rcov) do |spec|
36
- spec.pattern = 'spec/**/*_spec.rb'
37
- spec.rcov = true
38
- end
39
-
40
- task :default => :spec
41
-
42
- require 'rake/rdoctask'
43
- Rake::RDocTask.new do |rdoc|
44
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
45
-
46
- rdoc.rdoc_dir = 'rdoc'
47
- rdoc.title = "has_serialized #{version}"
48
- rdoc.rdoc_files.include('README*')
49
- rdoc.rdoc_files.include('lib/**/*.rb')
50
- end
@@ -3,82 +3,33 @@
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
+ $: << './lib'
7
+ require 'has_serialized/version'
8
+
6
9
  Gem::Specification.new do |s|
7
10
  s.name = %q{has_serialized}
8
- s.version = "0.1.3"
11
+ s.version = HasSerialized::VERSION
9
12
 
10
13
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
14
  s.authors = ["Ramon Tayag"]
12
15
  s.date = %q{2011-11-04}
13
16
  s.description = %q{Adds dynamic attributes through serialize. This way, it's in one table, and it's still trivial to track changes to your records.}
14
17
  s.email = %q{ramon@tayag.net}
15
- s.extra_rdoc_files = [
16
- "README.textile"
17
- ]
18
- s.files = [
19
- ".autotest",
20
- ".rvmrc",
21
- "Gemfile",
22
- "Gemfile.lock",
23
- "Guardfile",
24
- "MIT-LICENSE",
25
- "README.textile",
26
- "Rakefile",
27
- "VERSION",
28
- "has_serialized.gemspec",
29
- "lib/has_serialized.rb",
30
- "lib/has_serialized/class_methods.rb",
31
- "spec/fixtures/category.rb",
32
- "spec/fixtures/page.rb",
33
- "spec/has_serialized_spec.rb",
34
- "spec/spec_helper.rb"
35
- ]
18
+ s.extra_rdoc_files = %w(README.md)
19
+ s.license = 'MIT'
20
+
21
+ s.files = `git ls-files`.split("\n")
22
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
23
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
24
+ s.require_paths = ["lib"]
25
+
36
26
  s.homepage = %q{http://github.com/ramontayag/has_serialized}
37
27
  s.licenses = ["MIT"]
38
- s.require_paths = ["lib"]
39
28
  s.rubygems_version = %q{1.6.2}
40
29
  s.summary = %q{Adds dynamic attributes through serialize.}
41
- s.test_files = [
42
- "spec/fixtures/category.rb",
43
- "spec/fixtures/page.rb",
44
- "spec/has_serialized_spec.rb",
45
- "spec/spec_helper.rb"
46
- ]
47
-
48
- if s.respond_to? :specification_version then
49
- s.specification_version = 3
50
30
 
51
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
52
- s.add_runtime_dependency(%q<activerecord>, ["~> 3.1.0.rc"])
53
- s.add_development_dependency(%q<rspec>, ["~> 2.6.0"])
54
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
55
- s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
56
- s.add_development_dependency(%q<rcov>, [">= 0"])
57
- s.add_development_dependency(%q<guard-rspec>, [">= 0"])
58
- s.add_development_dependency(%q<libnotify>, [">= 0"])
59
- s.add_development_dependency(%q<sqlite3>, [">= 0"])
60
- s.add_development_dependency(%q<arel>, ["= 2.1.4"])
61
- else
62
- s.add_dependency(%q<activerecord>, ["~> 3.1.0.rc"])
63
- s.add_dependency(%q<rspec>, ["~> 2.6.0"])
64
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
65
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
66
- s.add_dependency(%q<rcov>, [">= 0"])
67
- s.add_dependency(%q<guard-rspec>, [">= 0"])
68
- s.add_dependency(%q<libnotify>, [">= 0"])
69
- s.add_dependency(%q<sqlite3>, [">= 0"])
70
- s.add_dependency(%q<arel>, ["= 2.1.4"])
71
- end
72
- else
73
- s.add_dependency(%q<activerecord>, ["~> 3.1.0.rc"])
74
- s.add_dependency(%q<rspec>, ["~> 2.6.0"])
75
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
76
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
77
- s.add_dependency(%q<rcov>, [">= 0"])
78
- s.add_dependency(%q<guard-rspec>, [">= 0"])
79
- s.add_dependency(%q<libnotify>, [">= 0"])
80
- s.add_dependency(%q<sqlite3>, [">= 0"])
81
- s.add_dependency(%q<arel>, ["= 2.1.4"])
82
- end
31
+ s.add_runtime_dependency 'activerecord', '>= 3.0.0'
32
+ s.add_development_dependency 'sqlite3'
33
+ s.add_development_dependency 'rspec'
83
34
  end
84
35
 
@@ -0,0 +1,3 @@
1
+ module HasSerialized
2
+ VERSION = '1.0.0'
3
+ end
@@ -1,2 +1,3 @@
1
1
  class Page < ActiveRecord::Base
2
+ has_serialized :dynamic_attributes, gunslinger: true
2
3
  end
@@ -7,9 +7,6 @@ describe HasSerialized do
7
7
 
8
8
  describe "accessing variables" do
9
9
  before do
10
- Page.class_eval do
11
- has_serialized :dynamic_attributes, :gunslinger => true
12
- end
13
10
  @page = Page.create!
14
11
  end
15
12
 
@@ -22,4 +19,9 @@ describe HasSerialized do
22
19
  @page.gunslinger.should be_false
23
20
  end
24
21
  end
22
+
23
+ it 'should be able to initialize with defaults' do
24
+ page = Page.new
25
+ expect(page.gunslinger).to be_true
26
+ end
25
27
  end
metadata CHANGED
@@ -1,220 +1,115 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: has_serialized
3
- version: !ruby/object:Gem::Version
4
- hash: 29
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 3
10
- version: 0.1.3
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Ramon Tayag
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-11-04 00:00:00 +08:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2011-11-04 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: activerecord
23
- version_requirements: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 7712034
29
- segments:
30
- - 3
31
- - 1
32
- - 0
33
- - rc
34
- version: 3.1.0.rc
35
- prerelease: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 3.0.0
36
22
  type: :runtime
37
- requirement: *id001
38
- - !ruby/object:Gem::Dependency
39
- name: rspec
40
- version_requirements: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ~>
44
- - !ruby/object:Gem::Version
45
- hash: 23
46
- segments:
47
- - 2
48
- - 6
49
- - 0
50
- version: 2.6.0
51
23
  prerelease: false
52
- type: :development
53
- requirement: *id002
54
- - !ruby/object:Gem::Dependency
55
- name: bundler
56
- version_requirements: &id003 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
57
25
  none: false
58
- requirements:
59
- - - ~>
60
- - !ruby/object:Gem::Version
61
- hash: 23
62
- segments:
63
- - 1
64
- - 0
65
- - 0
66
- version: 1.0.0
67
- prerelease: false
68
- type: :development
69
- requirement: *id003
70
- - !ruby/object:Gem::Dependency
71
- name: jeweler
72
- version_requirements: &id004 !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 3.0.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: sqlite3
32
+ requirement: !ruby/object:Gem::Requirement
73
33
  none: false
74
- requirements:
75
- - - ~>
76
- - !ruby/object:Gem::Version
77
- hash: 7
78
- segments:
79
- - 1
80
- - 5
81
- - 2
82
- version: 1.5.2
83
- prerelease: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
84
38
  type: :development
85
- requirement: *id004
86
- - !ruby/object:Gem::Dependency
87
- name: rcov
88
- version_requirements: &id005 !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- hash: 3
94
- segments:
95
- - 0
96
- version: "0"
97
39
  prerelease: false
98
- type: :development
99
- requirement: *id005
100
- - !ruby/object:Gem::Dependency
101
- name: guard-rspec
102
- version_requirements: &id006 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
103
41
  none: false
104
- requirements:
105
- - - ">="
106
- - !ruby/object:Gem::Version
107
- hash: 3
108
- segments:
109
- - 0
110
- version: "0"
111
- prerelease: false
112
- type: :development
113
- requirement: *id006
114
- - !ruby/object:Gem::Dependency
115
- name: libnotify
116
- version_requirements: &id007 !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
117
49
  none: false
118
- requirements:
119
- - - ">="
120
- - !ruby/object:Gem::Version
121
- hash: 3
122
- segments:
123
- - 0
124
- version: "0"
125
- prerelease: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
126
54
  type: :development
127
- requirement: *id007
128
- - !ruby/object:Gem::Dependency
129
- name: sqlite3
130
- version_requirements: &id008 !ruby/object:Gem::Requirement
131
- none: false
132
- requirements:
133
- - - ">="
134
- - !ruby/object:Gem::Version
135
- hash: 3
136
- segments:
137
- - 0
138
- version: "0"
139
55
  prerelease: false
140
- type: :development
141
- requirement: *id008
142
- - !ruby/object:Gem::Dependency
143
- name: arel
144
- version_requirements: &id009 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
145
57
  none: false
146
- requirements:
147
- - - "="
148
- - !ruby/object:Gem::Version
149
- hash: 3
150
- segments:
151
- - 2
152
- - 1
153
- - 4
154
- version: 2.1.4
155
- prerelease: false
156
- type: :development
157
- requirement: *id009
158
- description: Adds dynamic attributes through serialize. This way, it's in one table, and it's still trivial to track changes to your records.
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ description: Adds dynamic attributes through serialize. This way, it's in one table,
63
+ and it's still trivial to track changes to your records.
159
64
  email: ramon@tayag.net
160
65
  executables: []
161
-
162
66
  extensions: []
163
-
164
- extra_rdoc_files:
165
- - README.textile
166
- files:
67
+ extra_rdoc_files:
68
+ - README.md
69
+ files:
167
70
  - .autotest
168
- - .rvmrc
71
+ - .gitignore
72
+ - .ruby-version
73
+ - CHANGELOG
169
74
  - Gemfile
170
75
  - Gemfile.lock
171
- - Guardfile
172
76
  - MIT-LICENSE
173
- - README.textile
77
+ - README.md
174
78
  - Rakefile
175
- - VERSION
176
79
  - has_serialized.gemspec
177
80
  - lib/has_serialized.rb
178
81
  - lib/has_serialized/class_methods.rb
82
+ - lib/has_serialized/version.rb
179
83
  - spec/fixtures/category.rb
180
84
  - spec/fixtures/page.rb
181
85
  - spec/has_serialized_spec.rb
182
86
  - spec/spec_helper.rb
183
- has_rdoc: true
184
87
  homepage: http://github.com/ramontayag/has_serialized
185
- licenses:
88
+ licenses:
186
89
  - MIT
187
90
  post_install_message:
188
91
  rdoc_options: []
189
-
190
- require_paths:
92
+ require_paths:
191
93
  - lib
192
- required_ruby_version: !ruby/object:Gem::Requirement
94
+ required_ruby_version: !ruby/object:Gem::Requirement
193
95
  none: false
194
- requirements:
195
- - - ">="
196
- - !ruby/object:Gem::Version
197
- hash: 3
198
- segments:
199
- - 0
200
- version: "0"
201
- required_rubygems_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ! '>='
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
202
101
  none: false
203
- requirements:
204
- - - ">="
205
- - !ruby/object:Gem::Version
206
- hash: 3
207
- segments:
208
- - 0
209
- version: "0"
102
+ requirements:
103
+ - - ! '>='
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
210
106
  requirements: []
211
-
212
107
  rubyforge_project:
213
- rubygems_version: 1.6.2
108
+ rubygems_version: 1.8.23
214
109
  signing_key:
215
110
  specification_version: 3
216
111
  summary: Adds dynamic attributes through serialize.
217
- test_files:
112
+ test_files:
218
113
  - spec/fixtures/category.rb
219
114
  - spec/fixtures/page.rb
220
115
  - spec/has_serialized_spec.rb
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm ree-1.8.7-2011.03@has_serialized
data/Guardfile DELETED
@@ -1,8 +0,0 @@
1
- # A sample Guardfile
2
- # More info at https://github.com/guard/guard#readme
3
-
4
- guard 'rspec', :version => 2 do
5
- watch(%r{^spec/.+_spec\.rb})
6
- watch(%r{^lib/(.+)\.rb}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
- watch('spec/spec_helper.rb') { "spec" }
8
- end
data/README.textile DELETED
@@ -1,36 +0,0 @@
1
- h1. AttributeSerializer
2
-
3
- Based on the Attribute Serializer article written by Greg Moreno
4
- http://gregmoreno.ca/preventing-model-explosion-via-rails-serialization/
5
-
6
- h2. Example
7
-
8
- <pre>
9
- class User < ActiveRecord::Base
10
- has_serialized :preferences, :show_email => false, :locale => :en
11
- end
12
-
13
- u = User.new # automatically assigns the default preferences
14
- u.preferences
15
- => {:show_email => false, :locale => :en}
16
-
17
- u.show_email = true # I can change it like an attribute via @user.update_attributes(params[:user])
18
- u.preferences
19
- => {:show_email => true, :locale => :en }
20
- </pre>
21
-
22
- h2. Specs
23
-
24
- Run specs through @rake spec@ or @guard start@ for autotest-like testing.
25
-
26
- h2. Contributing to has_serialized
27
-
28
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
29
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
30
- * Fork the project
31
- * Start a feature/bugfix branch
32
- * Commit and push until you are happy with your contribution
33
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
34
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
35
-
36
- Copyright (c) 2011 Greg Moreno, Adam Cuppy and Ramon Tayag. Released under the MIT license
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.1.3