property_sets 0.3.0 → 0.3.2
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 +4 -4
- data/VERSION +1 -1
- data/lib/property_sets/active_record_extension.rb +8 -0
- data/property_sets.gemspec +2 -2
- data/test/test_property_sets.rb +8 -0
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -63,12 +63,12 @@ mass updates.
|
|
63
63
|
|
64
64
|
=== View helpers
|
65
65
|
|
66
|
-
We support a
|
66
|
+
We support a couple of convenience mechanisms for building forms and putting the values into the above hash structure. So far, only support check boxes and radio buttons:
|
67
67
|
|
68
68
|
<% form_for(:account, :html => { :method => :put }) do |f| %>
|
69
|
-
<h3>
|
70
|
-
|
71
|
-
</h3>
|
69
|
+
<h3><%= f.property_set(:settings).check_box :activated %> Activated?</h3>
|
70
|
+
<h3><%= f.property_set(:settings).radio_button :hot, "yes" %> Hot</h3>
|
71
|
+
<h3><%= f.property_set(:settings).radio_button :not, "no" %> Not</h3>
|
72
72
|
<% end %>
|
73
73
|
|
74
74
|
== Installation
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
@@ -45,6 +45,14 @@ module PropertySets
|
|
45
45
|
lookup(arg).protected?
|
46
46
|
end
|
47
47
|
|
48
|
+
define_method "enable" do |arg|
|
49
|
+
send("#{arg}=", "1")
|
50
|
+
end
|
51
|
+
|
52
|
+
define_method "disable" do |arg|
|
53
|
+
send("#{arg}=", "0")
|
54
|
+
end
|
55
|
+
|
48
56
|
# Assigns a new value to the property
|
49
57
|
define_method "#{key}=" do |value|
|
50
58
|
instance = lookup(key)
|
data/property_sets.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{property_sets}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Morten Primdahl"]
|
12
|
-
s.date = %q{2011-01-
|
12
|
+
s.date = %q{2011-01-28}
|
13
13
|
s.description = %q{This gem is an ActiveRecord extension which provides a convenient interface for managing per row properties}
|
14
14
|
s.email = %q{morten@zendesk.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/test/test_property_sets.rb
CHANGED
@@ -23,6 +23,14 @@ class TestPropertySets < ActiveSupport::TestCase
|
|
23
23
|
assert !@account.settings.protected?(:foo)
|
24
24
|
end
|
25
25
|
|
26
|
+
should "allow enabling/disabling a property" do
|
27
|
+
assert @account.settings.hep?
|
28
|
+
@account.settings.disable(:hep)
|
29
|
+
assert !@account.settings.hep?
|
30
|
+
@account.settings.enable(:hep)
|
31
|
+
assert @account.settings.hep?
|
32
|
+
end
|
33
|
+
|
26
34
|
should "be empty on a new account" do
|
27
35
|
assert @account.settings.empty?
|
28
36
|
assert @account.texts.empty?
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: property_sets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 2
|
10
|
+
version: 0.3.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Morten Primdahl
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-28 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|