it-logica-application-backbone 0.1.9 → 0.1.10
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/it-logica-application-backbone.gemspec +1 -1
- data/lib/initializers/initialize.rb +62 -46
- data/lib/it-logica-application-backbone.rb +1 -1
- metadata +12 -12
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.10
|
@@ -1,50 +1,66 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
include ViewMixins::Breadcrumb
|
9
|
-
include ViewMixins::Table
|
10
|
-
end
|
11
|
-
|
12
|
-
class ApplicationController
|
13
|
-
include ControllerMixins::RendererInstanceMethods
|
14
|
-
end
|
1
|
+
module Initializers
|
2
|
+
class Initialize < Rails::Railtie
|
3
|
+
initializer "initialize mixins" do
|
4
|
+
ActionView::Base.send :include, ViewMixins::Link
|
5
|
+
ActionView::Base.send :include, ViewMixins::Form
|
6
|
+
ActionView::Base.send :include, ViewMixins::Breadcrumb
|
7
|
+
ActionView::Base.send :include, ViewMixins::Table
|
15
8
|
|
9
|
+
ActionController::Base.send :include, ControllerMixins::RendererInstanceMethods
|
16
10
|
|
17
|
-
|
18
|
-
# it will yell it was updated by another user
|
19
|
-
module ActiveRecord
|
20
|
-
# = Active Record Persistence
|
21
|
-
module Persistence
|
22
|
-
|
23
|
-
def update_attributes(attributes, options = {})
|
24
|
-
if timestamp_control = attributes.delete(:control_against_overwrite_by_another_user)
|
25
|
-
if self.attributes['updated_at'] > timestamp_control
|
26
|
-
errors[:base] << I18n.t('activerecord.errors.messages.control_against_overwrite_by_another_user')
|
27
|
-
return false
|
28
|
-
end
|
29
|
-
end
|
30
|
-
with_transaction_returning_status do
|
31
|
-
self.assign_attributes(attributes, options)
|
32
|
-
save
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def update_attributes!(attributes, options = {})
|
37
|
-
if timestamp_control = attributes.delete(:control_against_overwrite_by_another_user)
|
38
|
-
if self.attributes['updated_at'] > timestamp_control
|
39
|
-
errors[:base] << I18n.t('activerecord.errors.messages.control_against_overwrite_by_another_user')
|
40
|
-
return false
|
41
|
-
end
|
42
|
-
end
|
43
|
-
with_transaction_returning_status do
|
44
|
-
self.assign_attributes(attributes, options)
|
45
|
-
save!
|
46
|
-
end
|
11
|
+
ActiveRecord::Base.send :extend, ModelMixins::TableBuilderClassMethods
|
47
12
|
end
|
48
|
-
|
49
13
|
end
|
50
|
-
end
|
14
|
+
end
|
15
|
+
#
|
16
|
+
#
|
17
|
+
#class ActiveRecord::Base
|
18
|
+
# extend ModelMixins::TableBuilderClassMethods
|
19
|
+
#end
|
20
|
+
#
|
21
|
+
#module ApplicationHelper
|
22
|
+
# include ViewMixins::Link
|
23
|
+
# include ViewMixins::Form
|
24
|
+
# include ViewMixins::Breadcrumb
|
25
|
+
# include ViewMixins::Table
|
26
|
+
#end
|
27
|
+
#
|
28
|
+
#class ApplicationController
|
29
|
+
# include ControllerMixins::RendererInstanceMethods
|
30
|
+
#end
|
31
|
+
#
|
32
|
+
#
|
33
|
+
## monkey patch for control of right timestamp when updating a model, in the case that somebody updatedd it in the time beetween show the form and update the form
|
34
|
+
## it will yell it was updated by another user
|
35
|
+
#module ActiveRecord
|
36
|
+
# # = Active Record Persistence
|
37
|
+
# module Persistence
|
38
|
+
#
|
39
|
+
# def update_attributes(attributes, options = {})
|
40
|
+
# if timestamp_control = attributes.delete(:control_against_overwrite_by_another_user)
|
41
|
+
# if self.attributes['updated_at'] > timestamp_control
|
42
|
+
# errors[:base] << I18n.t('activerecord.errors.messages.control_against_overwrite_by_another_user')
|
43
|
+
# return false
|
44
|
+
# end
|
45
|
+
# end
|
46
|
+
# with_transaction_returning_status do
|
47
|
+
# self.assign_attributes(attributes, options)
|
48
|
+
# save
|
49
|
+
# end
|
50
|
+
# end
|
51
|
+
#
|
52
|
+
# def update_attributes!(attributes, options = {})
|
53
|
+
# if timestamp_control = attributes.delete(:control_against_overwrite_by_another_user)
|
54
|
+
# if self.attributes['updated_at'] > timestamp_control
|
55
|
+
# errors[:base] << I18n.t('activerecord.errors.messages.control_against_overwrite_by_another_user')
|
56
|
+
# return false
|
57
|
+
# end
|
58
|
+
# end
|
59
|
+
# with_transaction_returning_status do
|
60
|
+
# self.assign_attributes(attributes, options)
|
61
|
+
# save!
|
62
|
+
# end
|
63
|
+
# end
|
64
|
+
#
|
65
|
+
# end
|
66
|
+
#end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: it-logica-application-backbone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-07-03 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: shoulda
|
16
|
-
requirement: &
|
16
|
+
requirement: &78569930 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *78569930
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rdoc
|
27
|
-
requirement: &
|
27
|
+
requirement: &78569650 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '3.12'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *78569650
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bundler
|
38
|
-
requirement: &
|
38
|
+
requirement: &78569270 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.1.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *78569270
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: jeweler
|
49
|
-
requirement: &
|
49
|
+
requirement: &78568940 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.8.4
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *78568940
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: simplecov
|
60
|
-
requirement: &
|
60
|
+
requirement: &78568690 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *78568690
|
69
69
|
description: longer description of your gem
|
70
70
|
email: ladislav.smola@it-logica.cz
|
71
71
|
executables: []
|
@@ -144,7 +144,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
144
144
|
version: '0'
|
145
145
|
segments:
|
146
146
|
- 0
|
147
|
-
hash:
|
147
|
+
hash: 993272001
|
148
148
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
149
|
none: false
|
150
150
|
requirements:
|