best_boy 0.1.0 → 0.1.1
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/README.md +1 -1
- data/app/views/layouts/best_boy_backend.html.erb +1 -7
- data/lib/best_boy/models/active_record/best_boy/eventable.rb +11 -8
- data/lib/best_boy/models/active_record/best_boy_event.rb +1 -1
- data/lib/best_boy/version.rb +1 -1
- data/lib/generators/active_record/templates/create_best_boy_events_table.rb +0 -1
- data/spec/best_boy/best_boy_event_spec.rb +2 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -39,7 +39,7 @@ This will install following files into your application
|
|
39
39
|
|
40
40
|
public/stylesheets/bootstrap_datepicker.css
|
41
41
|
|
42
|
-
See usage section for version information.
|
42
|
+
See usage section for version information. At the moment this gem does not support the rails 3.1 asset pipeline. It is planned in further versions.
|
43
43
|
|
44
44
|
Run the migration
|
45
45
|
|
@@ -1,12 +1,7 @@
|
|
1
1
|
<!doctype html>
|
2
|
-
|
3
|
-
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
|
4
|
-
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
|
5
|
-
<!-- Consider adding a manifest.appcache: h5bp.com/d/Offline -->
|
6
|
-
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
|
2
|
+
<html class="no-js" lang="en">
|
7
3
|
<head>
|
8
4
|
<meta charset="utf-8">
|
9
|
-
<meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible'>
|
10
5
|
<meta name="description" content="">
|
11
6
|
<meta name="viewport" content="width=device-width">
|
12
7
|
<title>BBAC - BestBoy Administration Center</title>
|
@@ -57,6 +52,5 @@
|
|
57
52
|
<%= yield %>
|
58
53
|
</div>
|
59
54
|
</div>
|
60
|
-
<%= yield :javascripts %>
|
61
55
|
</body>
|
62
56
|
</html>
|
@@ -2,10 +2,6 @@ module BestBoy
|
|
2
2
|
module Eventable
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
|
-
def eventable?
|
6
|
-
true
|
7
|
-
end
|
8
|
-
|
9
5
|
module ClassMethods
|
10
6
|
def has_a_best_boy
|
11
7
|
# meta programming
|
@@ -22,24 +18,31 @@ module BestBoy
|
|
22
18
|
#
|
23
19
|
#
|
24
20
|
after_create :trigger_create_event
|
25
|
-
|
21
|
+
after_destroy :trigger_destroy_event
|
26
22
|
end
|
27
23
|
end
|
28
24
|
|
29
25
|
module InstanceMethods
|
26
|
+
def eventable?
|
27
|
+
true
|
28
|
+
end
|
29
|
+
|
30
30
|
def trigger_create_event
|
31
31
|
create_best_boy_event_with_type "create"
|
32
32
|
end
|
33
33
|
|
34
34
|
def trigger_destroy_event
|
35
|
+
# best_boy_event = BestBoyEvent.new(:event => "destroy")
|
36
|
+
# best_boy_event.owner_type = self.class.name.to_s
|
37
|
+
# best_boy_event.save
|
35
38
|
create_best_boy_event_with_type "destroy"
|
36
39
|
end
|
37
40
|
|
38
|
-
def trigger_custom_event
|
39
|
-
create_best_boy_event_with_type(type) if type.present?
|
41
|
+
def trigger_custom_event(type)
|
42
|
+
create_best_boy_event_with_type(type.to_s) if type.present?
|
40
43
|
end
|
41
44
|
|
42
|
-
def create_best_boy_event_with_type
|
45
|
+
def create_best_boy_event_with_type(type)
|
43
46
|
best_boy_event = BestBoyEvent.new(:event => type)
|
44
47
|
best_boy_event.owner = self
|
45
48
|
best_boy_event.save
|
data/lib/best_boy/version.rb
CHANGED
@@ -6,7 +6,6 @@ class CreateBestBoyEventsTable < ActiveRecord::Migration
|
|
6
6
|
t.string :event
|
7
7
|
t.timestamps
|
8
8
|
end
|
9
|
-
add_index :best_boy_events, :owner_id
|
10
9
|
add_index :best_boy_events, :owner_type
|
11
10
|
add_index :best_boy_events, [:owner_id, :owner_type]
|
12
11
|
add_index :best_boy_events, :event
|
@@ -22,7 +22,8 @@ describe BestBoyEvent, 'with scopes' do
|
|
22
22
|
ActiveRecord::Base.connection.execute("DELETE FROM 'best_boy_events'")
|
23
23
|
example = Example.create
|
24
24
|
(1..times).each do
|
25
|
-
|
25
|
+
example.trigger_custom_event("year_test")
|
26
|
+
example.best_boy_events.last.update_attribute(:created_at, created_at)
|
26
27
|
end
|
27
28
|
end
|
28
29
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: best_boy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Christoph Seydel
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-06-
|
13
|
+
date: 2012-06-21 00:00:00 +02:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|