has_custom_fields 0.0.4 → 0.0.5

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 CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{has_custom_fields}
8
- s.version = "0.0.4"
8
+ s.version = "0.0.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["kylejginavan"]
12
- s.date = %q{2011-12-02}
12
+ s.date = %q{2012-01-27}
13
13
  s.description = %q{Uses a vertical schema to add custom fields.}
14
14
  s.email = %q{kylejginavan@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -99,7 +99,6 @@ module ActiveRecord # :nodoc:
99
99
  options[:parent] = self.name
100
100
 
101
101
  ::Rails.logger.debug("OPTIONS: #{options.inspect}")
102
- puts("OPTIONS: #{options.inspect}")
103
102
 
104
103
  # Init option storage if necessary
105
104
  cattr_accessor :custom_field_options
@@ -127,11 +126,13 @@ module ActiveRecord # :nodoc:
127
126
  belongs_to options[:fields_relationship_name],
128
127
  :class_name => '::CustomFields::' + options[:fields_class_name].singularize
129
128
  alias_method :field, options[:fields_relationship_name]
130
-
129
+
131
130
  def self.reloadable? #:nodoc:
132
131
  false
133
132
  end
134
-
133
+
134
+ validates_uniqueness_of options[:foreign_key].to_sym, :scope => "#{options[:fields_relationship_name]}_id".to_sym
135
+
135
136
  def validate
136
137
  field = self.field
137
138
  raise "Couldn't load field" if !field
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_custom_fields
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - kylejginavan
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-12-02 00:00:00 -06:00
18
+ date: 2012-01-27 00:00:00 -06:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency