active_presenter 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -0
- data/lib/active_presenter/base.rb +10 -1
- data/lib/active_presenter/version.rb +1 -1
- data/test/base_test.rb +8 -0
- metadata +2 -2
data/README
CHANGED
@@ -59,7 +59,7 @@ module ActivePresenter
|
|
59
59
|
|
60
60
|
self.attributes = args
|
61
61
|
end
|
62
|
-
|
62
|
+
|
63
63
|
# Set the attributes of the presentable instances using the type_attribute form (i.e. user_login => 'james')
|
64
64
|
#
|
65
65
|
def attributes=(attrs)
|
@@ -139,6 +139,15 @@ module ActivePresenter
|
|
139
139
|
save
|
140
140
|
end
|
141
141
|
|
142
|
+
# We define #id and #new_record? to play nice with form_for(@presenter) in Rails
|
143
|
+
def id # :nodoc:
|
144
|
+
nil
|
145
|
+
end
|
146
|
+
|
147
|
+
def new_record?
|
148
|
+
true
|
149
|
+
end
|
150
|
+
|
142
151
|
protected
|
143
152
|
def presented_instances
|
144
153
|
presented.keys.map { |key| send(key) }
|
data/test/base_test.rb
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
require File.dirname(__FILE__)+'/test_helper'
|
2
2
|
|
3
3
|
Expectations do
|
4
|
+
expect nil do
|
5
|
+
SignupPresenter.new.id
|
6
|
+
end
|
7
|
+
|
8
|
+
expect true do
|
9
|
+
SignupPresenter.new.new_record?
|
10
|
+
end
|
11
|
+
|
4
12
|
expect :user => User, :account => Account do
|
5
13
|
SignupPresenter.presented
|
6
14
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_presenter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Golick & Daniel Haran
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-01-22 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|