assignable_values 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/assignable_values/active_record/restriction/base.rb +1 -1
- data/lib/assignable_values/version.rb +1 -1
- data/spec/rails-2.3/Gemfile.lock +1 -1
- data/spec/rails-3.0/Gemfile.lock +1 -1
- data/spec/rails-3.2/Gemfile.lock +1 -1
- data/spec/shared/assignable_values/active_record_spec.rb +10 -0
- metadata +5 -5
@@ -202,7 +202,7 @@ module AssignableValues
|
|
202
202
|
def assignable_values_from_delegate(record)
|
203
203
|
delegate = delegate(record)
|
204
204
|
delegate.present? or raise DelegateUnavailable, "Cannot query a nil delegate for assignable values"
|
205
|
-
delegate_query_method = "assignable_#{model.name.underscore}_#{property.to_s.pluralize}"
|
205
|
+
delegate_query_method = "assignable_#{model.name.underscore.gsub('/', '_')}_#{property.to_s.pluralize}"
|
206
206
|
args = delegate.method(delegate_query_method).arity == 1 ? [record] : []
|
207
207
|
delegate.send(delegate_query_method, *args)
|
208
208
|
end
|
data/spec/rails-2.3/Gemfile.lock
CHANGED
data/spec/rails-3.0/Gemfile.lock
CHANGED
data/spec/rails-3.2/Gemfile.lock
CHANGED
@@ -264,6 +264,16 @@ describe AssignableValues::ActiveRecord do
|
|
264
264
|
klass.new(:genre => 'disallowed value').should_not be_valid
|
265
265
|
end
|
266
266
|
|
267
|
+
it 'should generate a legal getter name for a namespaced model (bugfix)' do
|
268
|
+
klass = Recording::Vinyl.disposable_copy do
|
269
|
+
assignable_values_for :year, :through => :delegate
|
270
|
+
def delegate
|
271
|
+
OpenStruct.new(:assignable_recording_vinyl_years => [1977, 1980, 1983])
|
272
|
+
end
|
273
|
+
end
|
274
|
+
klass.new.assignable_years.should == [1977, 1980, 1983]
|
275
|
+
end
|
276
|
+
|
267
277
|
it 'should skip the validation if that method returns nil' do
|
268
278
|
klass = Song.disposable_copy do
|
269
279
|
assignable_values_for :genre, :through => :delegate
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: assignable_values
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 1
|
10
|
+
version: 0.6.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Henning Koch
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-01-
|
18
|
+
date: 2013-01-15 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -210,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
210
210
|
requirements: []
|
211
211
|
|
212
212
|
rubyforge_project:
|
213
|
-
rubygems_version: 1.3.9.
|
213
|
+
rubygems_version: 1.3.9.5
|
214
214
|
signing_key:
|
215
215
|
specification_version: 3
|
216
216
|
summary: Restrict the values assignable to ActiveRecord attributes or associations. Or enums on steroids.
|