molten_core 0.0.1 → 0.0.2

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/lib/molten_core.rb CHANGED
@@ -5,8 +5,6 @@ require 'molten_core/integer'
5
5
  require 'molten_core/string'
6
6
  require 'molten_core/action_controller/controller_resources'
7
7
  require 'molten_core/active_model/validations/inclusion_validator'
8
- require 'molten_core/single_table_inheritable'
9
- require 'molten_core/unprotected_inheritance'
10
8
 
11
9
  module MoltenCore
12
10
  end
@@ -1,3 +1,3 @@
1
1
  module MoltenCore
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: molten_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-10-02 00:00:00.000000000 Z
13
+ date: 2012-10-18 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: ''
16
16
  email: support@chirrpy.com
@@ -26,9 +26,7 @@ files:
26
26
  - lib/molten_core/array.rb
27
27
  - lib/molten_core/hash.rb
28
28
  - lib/molten_core/integer.rb
29
- - lib/molten_core/single_table_inheritable.rb
30
29
  - lib/molten_core/string.rb
31
- - lib/molten_core/unprotected_inheritance.rb
32
30
  - lib/molten_core/version.rb
33
31
  - lib/molten_core.rb
34
32
  - Rakefile
@@ -1,29 +0,0 @@
1
- module SingleTableInheritable
2
- def update_type_and_attributes(options = {})
3
- object, new_type, attrs = options[:object], options[:new_type], options[:attributes]
4
-
5
- if new_type.present?
6
- affected_object_attributes = object.attributes.except('type').merge(attrs)
7
- affected_object = new_type.constantize.new
8
- else
9
- affected_object_attributes = object.attributes.merge(attrs)
10
- affected_object = object.class.new
11
- end
12
-
13
- affected_object.id = object.id
14
- affected_object.attributes = affected_object_attributes
15
-
16
- if affected_object.valid?
17
- object.before_update_type_and_attributes_delete
18
- object.delete
19
- affected_object.save
20
- else
21
- affected_object.instance_variable_set(:@new_record, object.new_record?)
22
- end
23
-
24
- affected_object
25
- end
26
-
27
- def before_update_type_and_attributes_delete
28
- end
29
- end
@@ -1,13 +0,0 @@
1
- ###
2
- # By default, the column used for Single Table Inheritance is protected from
3
- # mass-assignment. For the majority of cases (at least in this application) we
4
- # actually want the column to be able to be mass-assigned. Including this
5
- # module into the class will make that possible.
6
- #
7
- module UnprotectedInheritance
8
- def attributes_protected_by_default
9
- super.tap do |protected_columns|
10
- protected_columns.delete inheritance_column
11
- end
12
- end
13
- end