remarkable_activerecord 3.1.11 → 3.1.12

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.
@@ -28,8 +28,12 @@ module Remarkable
28
28
  return true unless @options.key?(:allow_destroy)
29
29
 
30
30
  @subject.instance_eval <<-ALLOW_DESTROY
31
- def assign_nested_attributes_for_#{reflection_type}_association(association, attrs, allow)
32
- return allow
31
+ def assign_nested_attributes_for_#{reflection_type}_association(association, *args)
32
+ if self.respond_to?(:nested_attributes_options)
33
+ self.nested_attributes_options[association.to_sym][:allow_destroy]
34
+ else
35
+ args.last
36
+ end
33
37
  end
34
38
  ALLOW_DESTROY
35
39
 
@@ -73,7 +77,11 @@ module Remarkable
73
77
  end
74
78
 
75
79
  def reject_if_proc
76
- subject_class.reject_new_nested_attributes_procs[@association.to_sym]
80
+ if subject_class.respond_to?(:nested_attributes_options)
81
+ subject_class.nested_attributes_options[@association.to_sym][:reject_if]
82
+ else
83
+ subject_class.reject_new_nested_attributes_procs[@association.to_sym]
84
+ end
77
85
  end
78
86
 
79
87
  end
@@ -15,25 +15,25 @@ module Remarkable
15
15
  #
16
16
  def allows?
17
17
  return positive? unless @attributes.empty?
18
- protected_attributes.empty?
18
+ protected_attributes.nil? || protected_attributes.empty?
19
19
  end
20
20
 
21
21
  def is_accessible?
22
- return positive? if accessible_attributes.empty?
22
+ return positive? if accessible_attributes.nil?
23
23
  accessible_attributes.include?(@attribute.to_s)
24
24
  end
25
25
 
26
26
  def is_protected?
27
- return accessible_attributes.empty? || positive? if protected_attributes.empty?
27
+ return accessible_attributes.nil? || positive? if protected_attributes.nil?
28
28
  !protected_attributes.include?(@attribute.to_s)
29
29
  end
30
30
 
31
31
  def interpolation_options
32
32
  if @subject
33
33
  if positive?
34
- { :protected_attributes => array_to_sentence(protected_attributes.to_a, false, '[]') }
34
+ { :protected_attributes => array_to_sentence((protected_attributes || []).to_a, false, '[]') }
35
35
  else
36
- { :accessible_attributes => array_to_sentence(accessible_attributes.to_a, false, '[]') }
36
+ { :accessible_attributes => array_to_sentence((accessible_attributes || []).to_a, false, '[]') }
37
37
  end
38
38
  else
39
39
  {}
@@ -43,11 +43,11 @@ module Remarkable
43
43
  private
44
44
 
45
45
  def accessible_attributes
46
- @accessible_attributes ||= subject_class.accessible_attributes || []
46
+ @accessible_attributes = subject_class.accessible_attributes
47
47
  end
48
48
 
49
49
  def protected_attributes
50
- @protected_attributes ||= subject_class.protected_attributes || []
50
+ @protected_attributes = subject_class.protected_attributes
51
51
  end
52
52
  end
53
53
 
@@ -0,0 +1,35 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{remarkable_activerecord}
5
+ s.version = "3.1.12"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Carlos Brando", "Jos\303\251 Valim", "Diego Carrion"]
9
+ s.date = %q{2010-01-19}
10
+ s.description = %q{Remarkable ActiveRecord: collection of matchers and macros with I18n for ActiveRecord}
11
+ s.email = ["eduardobrando@gmail.com", "jose.valim@gmail.com", "dc.rec1@gmail.com"]
12
+ s.extra_rdoc_files = ["README", "LICENSE", "CHANGELOG"]
13
+ s.files = ["README", "LICENSE", "CHANGELOG", "lib/remarkable_activerecord", "lib/remarkable_activerecord/base.rb", "lib/remarkable_activerecord/describe.rb", "lib/remarkable_activerecord/human_names.rb", "lib/remarkable_activerecord/matchers", "lib/remarkable_activerecord/matchers/accept_nested_attributes_for_matcher.rb", "lib/remarkable_activerecord/matchers/allow_mass_assignment_of_matcher.rb", "lib/remarkable_activerecord/matchers/allow_values_for_matcher.rb", "lib/remarkable_activerecord/matchers/association_matcher.rb", "lib/remarkable_activerecord/matchers/have_column_matcher.rb", "lib/remarkable_activerecord/matchers/have_default_scope_matcher.rb", "lib/remarkable_activerecord/matchers/have_index_matcher.rb", "lib/remarkable_activerecord/matchers/have_readonly_attributes_matcher.rb", "lib/remarkable_activerecord/matchers/have_scope_matcher.rb", "lib/remarkable_activerecord/matchers/validate_acceptance_of_matcher.rb", "lib/remarkable_activerecord/matchers/validate_associated_matcher.rb", "lib/remarkable_activerecord/matchers/validate_confirmation_of_matcher.rb", "lib/remarkable_activerecord/matchers/validate_exclusion_of_matcher.rb", "lib/remarkable_activerecord/matchers/validate_inclusion_of_matcher.rb", "lib/remarkable_activerecord/matchers/validate_length_of_matcher.rb", "lib/remarkable_activerecord/matchers/validate_numericality_of_matcher.rb", "lib/remarkable_activerecord/matchers/validate_presence_of_matcher.rb", "lib/remarkable_activerecord/matchers/validate_uniqueness_of_matcher.rb", "lib/remarkable_activerecord.rb", "locale/en.yml", "remarkable_activerecord.gemspec"]
14
+ s.homepage = %q{http://github.com/carlosbrando/remarkable}
15
+ s.require_paths = ["lib"]
16
+ s.rubyforge_project = %q{remarkable}
17
+ s.rubygems_version = %q{1.3.5}
18
+ s.summary = %q{Remarkable ActiveRecord: collection of matchers and macros with I18n for ActiveRecord}
19
+
20
+ if s.respond_to? :specification_version then
21
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
22
+ s.specification_version = 3
23
+
24
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
25
+ s.add_runtime_dependency(%q<rspec>, [">= 1.2.0"])
26
+ s.add_runtime_dependency(%q<remarkable>, ["~> 3.1.12"])
27
+ else
28
+ s.add_dependency(%q<rspec>, [">= 1.2.0"])
29
+ s.add_dependency(%q<remarkable>, ["~> 3.1.12"])
30
+ end
31
+ else
32
+ s.add_dependency(%q<rspec>, [">= 1.2.0"])
33
+ s.add_dependency(%q<remarkable>, ["~> 3.1.12"])
34
+ end
35
+ end
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.11
4
+ version: 3.1.12
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-10-01 00:00:00 -03:00
14
+ date: 2010-01-19 00:00:00 +01: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.11
35
+ version: 3.1.12
36
36
  version:
37
37
  description: "Remarkable ActiveRecord: collection of matchers and macros with I18n for ActiveRecord"
38
38
  email:
@@ -74,6 +74,7 @@ files:
74
74
  - lib/remarkable_activerecord/matchers/validate_uniqueness_of_matcher.rb
75
75
  - lib/remarkable_activerecord.rb
76
76
  - locale/en.yml
77
+ - remarkable_activerecord.gemspec
77
78
  has_rdoc: true
78
79
  homepage: http://github.com/carlosbrando/remarkable
79
80
  licenses: []
@@ -98,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
99
  requirements: []
99
100
 
100
101
  rubyforge_project: remarkable
101
- rubygems_version: 1.3.4
102
+ rubygems_version: 1.3.5
102
103
  signing_key:
103
104
  specification_version: 3
104
105
  summary: "Remarkable ActiveRecord: collection of matchers and macros with I18n for ActiveRecord"