schedulable 0.0.9 → 0.0.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.
- checksums.yaml +4 -4
- data/README.md +7 -6
- data/lib/schedulable/acts_as_schedulable.rb +2 -2
- data/lib/schedulable/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90281d70dc24a9d57ee6581d4ca0cb06fe5f0fd0
|
4
|
+
data.tar.gz: 6a76f52150e8a5f05b0376a23412df35f9006966
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1225038fbe0157e9c390cf2d90149d106bdd7c845303b18890a98e3a25b06b212df83a094ece48723028ec557a45e06ac2861b0f0b26bbf3db0bceb0ccaac857
|
7
|
+
data.tar.gz: 24854d5b9c16d9e903207af64809cb5dba5351bb78f9a5600c02677d1fca07e2dff7ab7f2aa0f1331f5d96cc2e411ca6d68501e5e9efefc87dbf19e239a86a62
|
data/README.md
CHANGED
@@ -25,7 +25,8 @@ rails g scaffold Event name:string
|
|
25
25
|
```
|
26
26
|
|
27
27
|
Configure your model to be schedulable:
|
28
|
-
|
28
|
+
|
29
|
+
```ruby
|
29
30
|
# app/models/event.rb
|
30
31
|
class Event < ActiveRecord::Base
|
31
32
|
acts_as_schedulable :schedule
|
@@ -114,7 +115,6 @@ You can customize the generated markup by providing a hash of html-attributes as
|
|
114
115
|
The schedulable-formhelper has built-in-support for Bootstrap. Simply point the style-option of schedule_input to `bootstrap` or set it as default in config.
|
115
116
|
|
116
117
|
```erb
|
117
|
-
|
118
118
|
<%= f.schedule_select :schedule, style: :bootstrap %>
|
119
119
|
```
|
120
120
|
|
@@ -147,7 +147,7 @@ Also provided with the plugin is a custom input for simple_form. Make sure, you
|
|
147
147
|
rails g schedulable:simple_form
|
148
148
|
```
|
149
149
|
|
150
|
-
```
|
150
|
+
```erb
|
151
151
|
<%# app/views/events/_form.html.erb %>
|
152
152
|
<%= simple_form_for(@event) do |f| %>
|
153
153
|
|
@@ -236,7 +236,7 @@ You can access ice_cube-methods directly via the schedule association:
|
|
236
236
|
</p>
|
237
237
|
```
|
238
238
|
|
239
|
-
```
|
239
|
+
```ruby
|
240
240
|
# Prints all occurrences of the event until one year from now
|
241
241
|
puts @event.schedule.occurrences(Time.now + 1.year)
|
242
242
|
# Export to ical
|
@@ -284,7 +284,8 @@ end
|
|
284
284
|
```
|
285
285
|
|
286
286
|
Declare occurrence-model with the acts_as_schedule-method like this:
|
287
|
-
|
287
|
+
|
288
|
+
```ruby
|
288
289
|
# app/models/event.rb
|
289
290
|
class Event < ActiveRecord::Base
|
290
291
|
acts_as_schedulable :schedule, occurrences: :event_occurrences
|
@@ -320,7 +321,7 @@ You may add this task to crontab.
|
|
320
321
|
|
321
322
|
With the 'whenever' gem this can be easily achieved.
|
322
323
|
|
323
|
-
```
|
324
|
+
```ruby
|
324
325
|
gem 'whenever', :require => false
|
325
326
|
```
|
326
327
|
|
@@ -40,12 +40,12 @@ module Schedulable
|
|
40
40
|
# remaining
|
41
41
|
remaining_occurrences_options = options[:occurrences].clone
|
42
42
|
remaining_occurrences_association = ("remaining_" << occurrences_association.to_s).to_sym
|
43
|
-
has_many remaining_occurrences_association, -> { where
|
43
|
+
has_many remaining_occurrences_association, -> { where("#{occurrences_table_name}.date >= ?", Time.now).order('date ASC') }, remaining_occurrences_options
|
44
44
|
|
45
45
|
# previous
|
46
46
|
previous_occurrences_options = options[:occurrences].clone
|
47
47
|
previous_occurrences_association = ("previous_" << occurrences_association.to_s).to_sym
|
48
|
-
has_many previous_occurrences_association, -> { where
|
48
|
+
has_many previous_occurrences_association, -> { where("#{occurrences_table_name}.date < ?", Time.now).order('date DESC')}, previous_occurrences_options
|
49
49
|
|
50
50
|
ActsAsSchedulable.add_occurrences_association(self, occurrences_association)
|
51
51
|
|
data/lib/schedulable/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: schedulable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rafael Nowrotek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|