remarkable_activerecord 3.1.5 → 3.1.6

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.
@@ -32,7 +32,10 @@ module Remarkable
32
32
  reflection.source_reflection rescue false
33
33
  end
34
34
 
35
+ # Polymorphic associations does not have a klass.
36
+ #
35
37
  def klass_exists?
38
+ return true if @options[:polymorphic]
36
39
  reflection.klass rescue nil
37
40
  end
38
41
 
@@ -9,12 +9,13 @@ describe 'association_matcher' do
9
9
  def define_and_validate(options={})
10
10
  columns = options.delete(:association_columns) || { :projects_count => :integer }
11
11
  define_model :company, columns
12
- define_model :super_company, columns
12
+ define_model :super_company, columns
13
13
 
14
14
  columns = options.delete(:model_columns) || { :company_id => :integer, :company_type => :string }
15
15
  @model = define_model :project, columns do
16
16
  belongs_to :company, options
17
- belongs_to :unknown
17
+ belongs_to :unknown
18
+ belongs_to :accountable, :polymorphic => true
18
19
  end
19
20
 
20
21
  belong_to :company
@@ -144,6 +145,11 @@ describe 'association_matcher' do
144
145
  it { should_not define_and_validate(:counter_cache => :association_count).counter_cache(:association_count) }
145
146
  it { should_not define_and_validate(:association_columns => { :association_count => :integer }).counter_cache(:association_count) }
146
147
  end
148
+
149
+ describe "with polymorphic option" do
150
+ before(:each){ define_and_validate(:model_columns => {:accountable_id => :integer, :accountable_type => :string}) }
151
+ it { should belong_to(:accountable).polymorphic }
152
+ end
147
153
 
148
154
  create_optional_boolean_specs(:readonly, self)
149
155
  create_optional_boolean_specs(:validate, self)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remarkable_activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.5
4
+ version: 3.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Brando
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2009-06-04 00:00:00 +02:00
14
+ date: 2009-06-06 00:00:00 +02:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
@@ -32,7 +32,7 @@ dependencies:
32
32
  requirements:
33
33
  - - ">="
34
34
  - !ruby/object:Gem::Version
35
- version: 3.1.5
35
+ version: 3.1.6
36
36
  version:
37
37
  description: "Remarkable ActiveRecord: collection of matchers and macros with I18n for ActiveRecord"
38
38
  email: