persistize 0.0.4 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +7 -7
- data/VERSION +1 -1
- data/lib/persistize.rb +1 -1
- data/persistize.gemspec +11 -5
- data/test/persistize_test.rb +2 -3
- data/test/test_helper.rb +2 -2
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -52,22 +52,22 @@ These examples are just some of the possible applications of this pattern, your
|
|
52
52
|
|
53
53
|
==Install
|
54
54
|
|
55
|
-
===As a
|
56
|
-
|
57
|
-
$ script/plugin install git://github.com/porras/persistize.git
|
58
|
-
|
59
|
-
===As a gem (Rails >= 2.1.0)
|
55
|
+
===As a gem
|
60
56
|
|
61
57
|
# in config/environment.rb
|
62
|
-
config.gem "
|
58
|
+
config.gem "persistize"
|
63
59
|
|
64
60
|
And then:
|
65
61
|
|
66
62
|
$ [sudo] rake gems:install
|
67
63
|
|
64
|
+
===As a plugin
|
65
|
+
|
66
|
+
$ script/plugin install git://github.com/porras/persistize.git
|
67
|
+
|
68
68
|
==To-do
|
69
69
|
|
70
|
-
* More kinds of dependencies (+has_one+, <
|
70
|
+
* More kinds of dependencies (+has_one+, <del>has_many :through</del>)
|
71
71
|
* Make cache optional (cache can cause records to be inconsistent if changed and not saved so it would be nice to be able to deactivate it)
|
72
72
|
|
73
73
|
Copyright (c) 2008 Luismi Cavallé & Sergio Gil, released under the MIT license
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/lib/persistize.rb
CHANGED
@@ -13,7 +13,7 @@ module Persistize
|
|
13
13
|
alias #{original_method} #{method} # alias _unpersistized_full_name full_name
|
14
14
|
#
|
15
15
|
def #{method} # def full_name
|
16
|
-
if new_record?
|
16
|
+
if new_record? || changed? # if new_record? || changed?
|
17
17
|
#{original_method} # _unpersistized_full_name
|
18
18
|
else # else
|
19
19
|
self[:#{attribute}] # self[:full_name]
|
data/persistize.gemspec
CHANGED
@@ -1,12 +1,15 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
1
4
|
# -*- encoding: utf-8 -*-
|
2
5
|
|
3
6
|
Gem::Specification.new do |s|
|
4
7
|
s.name = %q{persistize}
|
5
|
-
s.version = "0.0
|
8
|
+
s.version = "0.1.0"
|
6
9
|
|
7
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
11
|
s.authors = ["Sergio Gil", "Luismi Cavall\303\251"]
|
9
|
-
s.date = %q{
|
12
|
+
s.date = %q{2010-03-23}
|
10
13
|
s.email = %q{ballsbreaking@bebanjo.com}
|
11
14
|
s.extra_rdoc_files = [
|
12
15
|
"README.rdoc"
|
@@ -24,27 +27,30 @@ Gem::Specification.new do |s|
|
|
24
27
|
"test/models/person.rb",
|
25
28
|
"test/models/project.rb",
|
26
29
|
"test/models/task.rb",
|
30
|
+
"test/models/thing.rb",
|
31
|
+
"test/models/wadus/thing.rb",
|
27
32
|
"test/persistize_test.rb",
|
28
33
|
"test/test_helper.rb"
|
29
34
|
]
|
30
|
-
s.has_rdoc = true
|
31
35
|
s.homepage = %q{http://github.com/bebanjo/persistize}
|
32
36
|
s.rdoc_options = ["--charset=UTF-8"]
|
33
37
|
s.require_paths = ["lib"]
|
34
|
-
s.rubygems_version = %q{1.3.
|
38
|
+
s.rubygems_version = %q{1.3.5}
|
35
39
|
s.summary = %q{Easy denormalization for your ActiveRecord models}
|
36
40
|
s.test_files = [
|
37
41
|
"test/models/company.rb",
|
38
42
|
"test/models/person.rb",
|
39
43
|
"test/models/project.rb",
|
40
44
|
"test/models/task.rb",
|
45
|
+
"test/models/thing.rb",
|
46
|
+
"test/models/wadus/thing.rb",
|
41
47
|
"test/persistize_test.rb",
|
42
48
|
"test/test_helper.rb"
|
43
49
|
]
|
44
50
|
|
45
51
|
if s.respond_to? :specification_version then
|
46
52
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
47
|
-
s.specification_version =
|
53
|
+
s.specification_version = 3
|
48
54
|
|
49
55
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
50
56
|
else
|
data/test/persistize_test.rb
CHANGED
@@ -29,10 +29,9 @@ class PersistizeTest < Test::Unit::TestCase
|
|
29
29
|
assert_equal(@person, Person.find_by_full_name('Axl Rose'))
|
30
30
|
end
|
31
31
|
|
32
|
-
should "
|
32
|
+
should "call the method when object is dirty" do
|
33
33
|
@person.first_name = 'Axl'
|
34
|
-
assert_equal('
|
35
|
-
# TODO: Rethink this behaviour. Do we want to cache or not?
|
34
|
+
assert_equal('Axl Hendrix', @person.full_name)
|
36
35
|
end
|
37
36
|
|
38
37
|
should "call the method when reading before being created" do
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: persistize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergio Gil
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date:
|
13
|
+
date: 2010-03-23 00:00:00 +01:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|