sample_models 2.3.0 → 2.3.1
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/VERSION +1 -1
- data/lib/sample_models/creation.rb +2 -1
- data/lib/sample_models/model.rb +8 -0
- data/sample_models.gemspec +2 -2
- data/test/unit/polymorphic_belongs_to_test.rb +6 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.1
|
data/lib/sample_models/model.rb
CHANGED
@@ -72,6 +72,14 @@ module SampleModels
|
|
72
72
|
@assoc.primary_key_name
|
73
73
|
end
|
74
74
|
end
|
75
|
+
|
76
|
+
def foreign_type
|
77
|
+
if @assoc.respond_to?(:foreign_type)
|
78
|
+
@assoc.foreign_type
|
79
|
+
else
|
80
|
+
@assoc.instance_variable_get(:@options)[:foreign_type]
|
81
|
+
end
|
82
|
+
end
|
75
83
|
|
76
84
|
def has_many?
|
77
85
|
@assoc.macro == :has_many
|
data/sample_models.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "sample_models"
|
8
|
-
s.version = "2.3.
|
8
|
+
s.version = "2.3.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Francis Hwang"]
|
12
|
-
s.date = "2012-03-
|
12
|
+
s.date = "2012-03-19"
|
13
13
|
s.description = "\nA library for making it extremely fast for Rails developers to set up and save ActiveRecord instances when writing test cases. It aims to:\n\n* meet all your validations automatically\n* only make you specify the attributes you care about\n* give you a rich set of features so you can specify associated values as concisely as possible\n* do this with as little configuration as possible\n"
|
14
14
|
s.email = "francis.hwang@profitably.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.dirname(__FILE__)
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '/../test_helper'))
|
2
2
|
|
3
3
|
class PolymorphicBelongsToTest < SampleModelsTestCase
|
4
4
|
def test_fills_association_with_anything_from_another_class
|
@@ -12,6 +12,11 @@ class PolymorphicBelongsToTest < SampleModelsTestCase
|
|
12
12
|
blog_post = BlogPost.sample
|
13
13
|
bookmark = Bookmark.sample :bookmarkable => blog_post
|
14
14
|
assert_equal blog_post, bookmark.bookmarkable
|
15
|
+
assert(
|
16
|
+
Bookmark.all(
|
17
|
+
:conditions => {:bookmarkable_type => 'BlogPost'}
|
18
|
+
).include?(bookmark)
|
19
|
+
)
|
15
20
|
end
|
16
21
|
|
17
22
|
def test_can_specify_association_with_other_leading_associations
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: sample_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 2.3.
|
5
|
+
version: 2.3.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Francis Hwang
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-03-
|
13
|
+
date: 2012-03-19 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|