acts_as_working_days 0.0.2 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,13 +1,70 @@
1
- ActsAsWorkingDays
2
- ================
1
+ = ActsAsWorkingDays
3
2
 
4
- Introduction goes here.
3
+ acts_as_working_days is a Rails plugin to add working days on models
5
4
 
5
+ == Usage
6
6
 
7
- Example
8
- =======
7
+ class Company < ActiveRecord::Base
8
+
9
+ acts_as_working_days
9
10
 
10
- Example goes here.
11
+ end
12
+
13
+ #Sample test code
14
+ def test_working_day
11
15
 
16
+ kwik_e_mart = Company.new(:name => 'Kwik-E-Mart')
17
+
18
+ #1 is Monday - Apu Kwik-E-Mart is only opened on Mondays, start 8h30, end 18h45
19
+ kwik_e_mart.put_working_day(:week_day => 1, :start_hour => 8, :start_min => 30, :end_hour => 18, :end_min => 45)
20
+
21
+ #Save model and working day
22
+ kwik_e_mart.save
23
+
24
+ #0 is Sunday - 12h45 is closed
25
+ assert_equal false, kwik_e_mart.working_day?(:week_day => 0, :hour => 12, :min => 0)
26
+
27
+ #1 is Monday - 21h00 is closed
28
+ assert_equal false, kwik_e_mart.working_day?(:week_day => 1, :hour => 21)
29
+
30
+ #1 is Monday - 12h15 is opened
31
+ assert_equal true, kwik_e_mart.working_day?(:week_day => 1, :hour => 12, :min => 15)
32
+
33
+ end
34
+
35
+
36
+ == Installation
37
+
38
+ === Rails 2.3.x
39
+
40
+ Acts As Working Days On is tested to work in Rails 2.3.5.
41
+
42
+ ==== Plugin
43
+
44
+ script/plugin install git://github.com/phstc/acts_as_working_days
45
+
46
+ ==== Post Installation
47
+
48
+ 1. script/generate acts_as_working_days_migration
49
+ 2. rake db:migrate
50
+
51
+ === Rails 3.0
52
+
53
+ Acts As Working Days On is tested to work in Rails 2.3.5.
54
+
55
+ To use it, add it to your Gemfile:
56
+
57
+ gem 'acts_as_working_days'
58
+
59
+ ==== Post Installation
60
+
61
+ 1. rails generate acts_as_working_days:migration
62
+ 2. rake db:migrate
63
+
64
+ == Testing
65
+
66
+ Inside the plugin directory, you can run the tests with:
67
+
68
+ rake test
12
69
 
13
70
  Copyright (c) 2010 Pablo Cantero, released under the MIT license
@@ -1,3 +1,6 @@
1
+ #gem build acts_as_working_days.gemspec
2
+ #gem push acts_as_working_days-0.0.1.gem
3
+
1
4
  require 'rake/gempackagetask'
2
5
 
3
6
  PKG_FILES = FileList[
@@ -8,10 +11,10 @@ PKG_FILES = FileList[
8
11
  'tasks/**/*',
9
12
  'test/**/*'
10
13
  ]
11
-
14
+
12
15
  spec = Gem::Specification.new do |s|
13
16
  s.name = "acts_as_working_days"
14
- s.version = "0.0.2"
17
+ s.version = "0.0.4"
15
18
  s.author = "Pablo Cantero"
16
19
  s.email = "pablo@pablocantero.com"
17
20
  s.homepage = "http://pablocantero.com/"
@@ -22,8 +25,8 @@ spec = Gem::Specification.new do |s|
22
25
  s.has_rdoc = false
23
26
  s.extra_rdoc_files = ["README.rdoc"]
24
27
  end
25
-
26
- desc 'Turn this plugin into a gem.'
27
- Rake::GemPackageTask.new(spec) do |pkg|
28
- pkg.gem_spec = spec
29
- end
28
+
29
+ #desc 'Turn this plugin into a gem.'
30
+ #Rake::GemPackageTask.new(spec) do |pkg|
31
+ # pkg.gem_spec = spec
32
+ #end
@@ -0,0 +1,7 @@
1
+ class ActsAsWorkingDaysMigrationGenerator < Rails::Generator::Base
2
+ def manifest
3
+ record do |m|
4
+ m.migration_template 'migration.rb', 'db/migrate', :migration_file_name => "acts_as_working_days_migration"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,25 @@
1
+ class ActsAsWorkingDaysMigration < ActiveRecord::Migration
2
+
3
+ def self.up
4
+ create_table :working_days, :force => true do |t|
5
+ #Date time columns
6
+ t.integer :week_day
7
+ t.integer :start_hour
8
+ t.integer :start_min
9
+ t.integer :end_hour
10
+ t.integer :end_min
11
+ #Polymorphic columns
12
+ t.integer :workable_id
13
+ t.string :workable_type
14
+
15
+ t.timestamps
16
+ end
17
+ add_index :working_days, [:workable_id, :workable_type]
18
+ end
19
+
20
+ def self.down
21
+ drop_table :working_days
22
+ remove_index :working_days, [:workable_id, :workable_type]
23
+ end
24
+
25
+ end
@@ -14,13 +14,18 @@ module ActsAsWorkingDays
14
14
 
15
15
  module InstanceMethods
16
16
  def working_day?(params ={:week_day => Time.now.wday, :hour => Time.now.hour, :min => Time.now.min })
17
- result = working_days.where("week_day = :week_day AND ((start_hour < :hour) OR (start_hour = :hour AND start_min <= :min)) AND ((end_hour > :hour) OR (end_hour = :hour AND end_min <= :min))",
18
- {
19
- :week_day => params[:week_day],
20
- :hour => params[:hour],
21
- :min => params[:min]
22
- })
23
- !result.empty?
17
+ result = nil
18
+ where = 'week_day = :week_day AND ((start_hour < :hour) OR (start_hour = :hour AND start_min <= :min)) AND ((end_hour > :hour) OR (end_hour = :hour AND end_min <= :min))'
19
+ params = {:week_day => params[:week_day], :hour => params[:hour], :min => params[:min]}
20
+ #To prevent @Depecrate
21
+ if working_days.respond_to?('where')
22
+ #Rails 3 style
23
+ result = working_days.where(where, params)
24
+ else
25
+ #Rails 2x style
26
+ result = working_days.find(:all, :conditions => [where, params])
27
+ end
28
+ return !result.empty?
24
29
  end
25
30
 
26
31
  def put_working_day(params = {:week_day => Time.now.wday, :start_hour => 0, :start_min => 0, :end_hour => 23, :end_min => 59})
@@ -14,12 +14,12 @@ class ActsAsWorkingDaysMigration < ActiveRecord::Migration
14
14
 
15
15
  t.timestamps
16
16
  end
17
+ add_index :working_days, [:workable_id, :workable_type]
17
18
  end
18
-
19
- add_index :working_days, [:workable_id, :workable_type]
20
-
19
+
21
20
  def self.down
22
21
  drop_table :working_days
22
+ remove_index :working_days, [:workable_id, :workable_type]
23
23
  end
24
24
 
25
25
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_working_days
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Pablo Cantero
@@ -29,6 +29,7 @@ extra_rdoc_files:
29
29
  - README.rdoc
30
30
  files:
31
31
  - acts_as_working_days-0.0.1.gem
32
+ - acts_as_working_days-0.0.3.gem
32
33
  - acts_as_working_days.gemspec
33
34
  - init.rb
34
35
  - install.rb
@@ -36,15 +37,15 @@ files:
36
37
  - Rakefile
37
38
  - README.rdoc
38
39
  - uninstall.rb
40
+ - generators/acts_as_working_days_migration/acts_as_working_days_migration_generator.rb
41
+ - generators/acts_as_working_days_migration/templates/migration.rb
39
42
  - lib/acts_as_working_days.rb
40
43
  - lib/generators/acts_as_working_days/migration/migration_generator.rb
41
44
  - lib/generators/acts_as_working_days/migration/templates/active_record/migration.rb
42
45
  - lib/tasks/acts_as_working_days_tasks.rake
43
46
  - rails/init.rb
44
- - test/acts_as_working_days_plugin.sqlite3.db
45
47
  - test/acts_as_working_days_test.rb
46
48
  - test/database.yml
47
- - test/debug.log
48
49
  - test/schema.rb
49
50
  - test/test_helper.rb
50
51
  - test/working_day_test.rb
@@ -1,161 +0,0 @@
1
- # Logfile created on Fri Nov 19 18:17:34 -0200 2010 by logger.rb/22285
2
- SQL (0.3ms) select sqlite_version(*)
3
- SQL (0.4ms) SELECT name
4
- FROM sqlite_master
5
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
6
-
7
- SQL (2.4ms) CREATE TABLE "companies" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255)) 
8
- SQL (0.2ms) SELECT name
9
- FROM sqlite_master
10
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
11
-
12
- SQL (1.3ms) CREATE TABLE "working_days" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "week_day" integer, "start_hour" integer, "start_min" integer, "end_hour" integer, "end_min" integer, "workable_id" integer, "workable_type" varchar(255), "created_at" datetime, "updated_at" datetime) 
13
- SQL (0.2ms) SELECT name
14
- FROM sqlite_master
15
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
16
-
17
- SQL (1.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
18
- SQL (0.1ms) PRAGMA index_list("schema_migrations")
19
- SQL (1.3ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
20
- SQL (0.2ms) SELECT name
21
- FROM sqlite_master
22
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
23
-
24
- SQL (0.1ms) SELECT version FROM "schema_migrations"
25
- SQL (1.0ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
26
- SQL (0.1ms) select sqlite_version(*)
27
- SQL (0.3ms) SELECT name
28
- FROM sqlite_master
29
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
30
-
31
- SQL (2.0ms) DROP TABLE "companies"
32
- SQL (1.2ms) CREATE TABLE "companies" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
33
- SQL (0.2ms)  SELECT name
34
- FROM sqlite_master
35
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
36
- 
37
- SQL (1.1ms) DROP TABLE "working_days"
38
- SQL (1.3ms) CREATE TABLE "working_days" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "week_day" integer, "start_hour" integer, "start_min" integer, "end_hour" integer, "end_min" integer, "workable_id" integer, "workable_type" varchar(255), "created_at" datetime, "updated_at" datetime) 
39
- SQL (0.2ms) SELECT name
40
- FROM sqlite_master
41
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
42
-
43
- SQL (0.1ms) SELECT version FROM "schema_migrations"
44
- SQL (0.2ms) SELECT name
45
- FROM sqlite_master
46
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
47
-
48
- SQL (0.1ms) DELETE FROM "companies" WHERE 1=1
49
- WorkingDay Load (0.1ms) SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 1) AND ("working_days"."workable_id" IS NULL) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1
50
- SQL (0.3ms) INSERT INTO "companies" ("name") VALUES ('Kwik-E-Mart')
51
- WorkingDay Load (0.1ms) SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 1) AND ("working_days"."workable_id" = 1) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1
52
- SQL (0.1ms) INSERT INTO "working_days" ("created_at", "end_hour", "end_min", "start_hour", "start_min", "updated_at", "week_day", "workable_id", "workable_type") VALUES ('2010-11-19 20:17:34.276908', 18, 45, 8, 30, '2010-11-19 20:17:34.276908', 1, 1, 'ActsAsWorkingDaysTest::Company')
53
- SQL (0.3ms) SELECT COUNT(*) AS count_id FROM (SELECT 1 FROM "working_days" WHERE ("working_days".workable_id = 1 AND "working_days".workable_type = 'ActsAsWorkingDaysTest::Company') AND (week_day = 0 AND ((start_hour < 12) OR (start_hour = 12 AND start_min <= 0)) AND ((end_hour > 12) OR (end_hour = 12 AND end_min <= 0)))) AS subquery
54
- SQL (0.3ms) SELECT COUNT(*) AS count_id FROM (SELECT 1 FROM "working_days" WHERE ("working_days".workable_id = 1 AND "working_days".workable_type = 'ActsAsWorkingDaysTest::Company') AND (week_day = 1 AND ((start_hour < 21) OR (start_hour = 21 AND start_min <= NULL)) AND ((end_hour > 21) OR (end_hour = 21 AND end_min <= NULL)))) AS subquery
55
- SQL (0.2ms) SELECT COUNT(*) AS count_id FROM (SELECT 1 FROM "working_days" WHERE ("working_days".workable_id = 1 AND "working_days".workable_type = 'ActsAsWorkingDaysTest::Company') AND (week_day = 1 AND ((start_hour < 7) OR (start_hour = 7 AND start_min <= 15)) AND ((end_hour > 7) OR (end_hour = 7 AND end_min <= 15)))) AS subquery
56
- SQL (1.2ms) DELETE FROM "companies" WHERE 1=1
57
- WorkingDay Load (0.2ms) SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" IS NULL) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1
58
- SQL (0.2ms) INSERT INTO "companies" ("name") VALUES ('Moes Tavern')
59
- WorkingDay Load (0.1ms) SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" = 2) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1
60
- SQL (0.2ms) INSERT INTO "working_days" ("created_at", "end_hour", "end_min", "start_hour", "start_min", "updated_at", "week_day", "workable_id", "workable_type") VALUES ('2010-11-19 20:17:34.293433', 18, 45, 8, 30, '2010-11-19 20:17:34.293433', 0, 2, 'ActsAsWorkingDaysTest::Company')
61
- WorkingDay Load (0.2ms) SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" = 2) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') AND ("working_days".id <> 2) LIMIT 1
62
- SQL (0.3ms) UPDATE "working_days" SET "end_hour" = 19, "end_min" = 23, "start_hour" = 10, "start_min" = 13, "updated_at" = '2010-11-19 20:17:34.300106' WHERE ("working_days"."id" = 2)
63
- SQL (1.0ms) DELETE FROM "companies" WHERE 1=1
64
- WorkingDay Load (0.2ms) SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" IS NULL) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1
65
- SQL (0.3ms) INSERT INTO "companies" ("name") VALUES ('The Leftorium')
66
- WorkingDay Load (0.1ms) SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" = 3) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1
67
- SQL (0.1ms) INSERT INTO "working_days" ("created_at", "end_hour", "end_min", "start_hour", "start_min", "updated_at", "week_day", "workable_id", "workable_type") VALUES ('2010-11-19 20:17:34.309800', 18, 45, 8, 30, '2010-11-19 20:17:34.309800', 0, 3, 'ActsAsWorkingDaysTest::Company')
68
- SQL (1.2ms) DELETE FROM "companies" WHERE 1=1
69
- ActsAsWorkingDaysTest::Company Load (0.1ms) SELECT "companies".* FROM "companies"
70
- SQL (0.1ms) DELETE FROM "companies" WHERE 1=1
71
- WorkingDay Load (0.1ms) SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" IS NULL) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1
72
- SQL (0.3ms) INSERT INTO "companies" ("name") VALUES ('Moes Tavern')
73
- WorkingDay Load (0.1ms) SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" = 4) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1
74
- SQL (0.2ms) INSERT INTO "working_days" ("created_at", "end_hour", "end_min", "start_hour", "start_min", "updated_at", "week_day", "workable_id", "workable_type") VALUES ('2010-11-19 20:17:34.320302', 18, 45, 8, 30, '2010-11-19 20:17:34.320302', 0, 4, 'ActsAsWorkingDaysTest::Company')
75
- SQL (0.2ms) SELECT COUNT(*) AS count_id FROM (SELECT 1 FROM "working_days" WHERE ("working_days".workable_id = 4 AND "working_days".workable_type = 'ActsAsWorkingDaysTest::Company') AND (week_day = 0 AND ((start_hour < 12) OR (start_hour = 12 AND start_min <= NULL)) AND ((end_hour > 12) OR (end_hour = 12 AND end_min <= NULL)))) AS subquery
76
- SQL (1.0ms) DELETE FROM "companies" WHERE 1=1
77
- WorkingDay Load (0.2ms) SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" IS NULL) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1
78
- SQL (0.3ms) INSERT INTO "working_days" ("created_at", "end_hour", "end_min", "start_hour", "start_min", "updated_at", "week_day", "workable_id", "workable_type") VALUES ('2010-11-19 20:17:34.329076', 19, 30, 9, 15, '2010-11-19 20:17:34.329076', 0, NULL, 'ActsAsWorkingDaysTest::Company')
79
- WorkingDay Load (0.2ms) SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" IS NULL) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') AND ("working_days".id <> 5) LIMIT 1
80
- SQL (0.3ms) INSERT INTO "companies" ("name") VALUES ('Springfield Nuclear Power Plant')
81
- WorkingDay Load (0.1ms) SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" = 5) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') AND ("working_days".id <> 5) LIMIT 1
82
- SQL (0.1ms) UPDATE "working_days" SET "updated_at" = '2010-11-19 20:17:34.336563', "workable_id" = 5 WHERE ("working_days"."id" = 5)
83
- WorkingDay Load (0.2ms) SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" = 5) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') AND ("working_days".id <> 5) LIMIT 1
84
- SQL (0.3ms) UPDATE "working_days" SET "end_hour" = 16, "end_min" = 15, "start_hour" = 6, "start_min" = 0, "updated_at" = '2010-11-19 20:17:34.341172' WHERE ("working_days"."id" = 5)
85
- SQL (0.2ms) select sqlite_version(*)
86
- SQL (0.4ms) SELECT name
87
- FROM sqlite_master
88
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
89
-
90
- SQL (2.6ms) DROP TABLE "companies"
91
- SQL (1.1ms) CREATE TABLE "companies" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
92
- SQL (0.2ms)  SELECT name
93
- FROM sqlite_master
94
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
95
- 
96
- SQL (1.1ms) DROP TABLE "working_days"
97
- SQL (1.3ms) CREATE TABLE "working_days" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "week_day" integer, "start_hour" integer, "start_min" integer, "end_hour" integer, "end_min" integer, "workable_id" integer, "workable_type" varchar(255), "created_at" datetime, "updated_at" datetime) 
98
- SQL (0.2ms) SELECT name
99
- FROM sqlite_master
100
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
101
-
102
- SQL (0.1ms) SELECT version FROM "schema_migrations"
103
- SQL (0.1ms) select sqlite_version(*)
104
- SQL (0.3ms)  SELECT name
105
- FROM sqlite_master
106
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
107
- 
108
- SQL (1.2ms) DROP TABLE "companies"
109
- SQL (1.0ms) CREATE TABLE "companies" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255)) 
110
- SQL (0.2ms) SELECT name
111
- FROM sqlite_master
112
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
113
-
114
- SQL (1.4ms) DROP TABLE "working_days"
115
- SQL (1.5ms) CREATE TABLE "working_days" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "week_day" integer, "start_hour" integer, "start_min" integer, "end_hour" integer, "end_min" integer, "workable_id" integer, "workable_type" varchar(255), "created_at" datetime, "updated_at" datetime)
116
- SQL (0.4ms)  SELECT name
117
- FROM sqlite_master
118
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
119
- 
120
- SQL (0.1ms) SELECT version FROM "schema_migrations"
121
- SQL (0.2ms)  SELECT name
122
- FROM sqlite_master
123
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
124
- 
125
- SQL (0.1ms) DELETE FROM "companies" WHERE 1=1
126
- WorkingDay Load (0.1ms) SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 1) AND ("working_days"."workable_id" IS NULL) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1
127
- SQL (0.3ms) INSERT INTO "companies" ("name") VALUES ('Kwik-E-Mart')
128
- WorkingDay Load (0.1ms) SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 1) AND ("working_days"."workable_id" = 1) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1
129
- SQL (0.1ms) INSERT INTO "working_days" ("created_at", "end_hour", "end_min", "start_hour", "start_min", "updated_at", "week_day", "workable_id", "workable_type") VALUES ('2010-11-19 20:17:39.252654', 18, 45, 8, 30, '2010-11-19 20:17:39.252654', 1, 1, 'ActsAsWorkingDaysTest::Company')
130
- SQL (0.3ms) SELECT COUNT(*) AS count_id FROM (SELECT 1 FROM "working_days" WHERE ("working_days".workable_id = 1 AND "working_days".workable_type = 'ActsAsWorkingDaysTest::Company') AND (week_day = 0 AND ((start_hour < 12) OR (start_hour = 12 AND start_min <= 0)) AND ((end_hour > 12) OR (end_hour = 12 AND end_min <= 0)))) AS subquery
131
- SQL (0.2ms) SELECT COUNT(*) AS count_id FROM (SELECT 1 FROM "working_days" WHERE ("working_days".workable_id = 1 AND "working_days".workable_type = 'ActsAsWorkingDaysTest::Company') AND (week_day = 1 AND ((start_hour < 21) OR (start_hour = 21 AND start_min <= NULL)) AND ((end_hour > 21) OR (end_hour = 21 AND end_min <= NULL)))) AS subquery
132
- SQL (0.2ms) SELECT COUNT(*) AS count_id FROM (SELECT 1 FROM "working_days" WHERE ("working_days".workable_id = 1 AND "working_days".workable_type = 'ActsAsWorkingDaysTest::Company') AND (week_day = 1 AND ((start_hour < 7) OR (start_hour = 7 AND start_min <= 15)) AND ((end_hour > 7) OR (end_hour = 7 AND end_min <= 15)))) AS subquery
133
- SQL (1.1ms) DELETE FROM "companies" WHERE 1=1
134
- WorkingDay Load (0.2ms) SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" IS NULL) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1
135
- SQL (0.3ms) INSERT INTO "companies" ("name") VALUES ('Moes Tavern')
136
- WorkingDay Load (0.1ms) SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" = 2) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1
137
- SQL (0.1ms) INSERT INTO "working_days" ("created_at", "end_hour", "end_min", "start_hour", "start_min", "updated_at", "week_day", "workable_id", "workable_type") VALUES ('2010-11-19 20:17:39.268266', 18, 45, 8, 30, '2010-11-19 20:17:39.268266', 0, 2, 'ActsAsWorkingDaysTest::Company')
138
- WorkingDay Load (0.2ms) SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" = 2) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') AND ("working_days".id <> 2) LIMIT 1
139
- SQL (0.3ms) UPDATE "working_days" SET "end_hour" = 19, "end_min" = 23, "start_hour" = 10, "start_min" = 13, "updated_at" = '2010-11-19 20:17:39.273344' WHERE ("working_days"."id" = 2)
140
- SQL (1.1ms) DELETE FROM "companies" WHERE 1=1
141
- WorkingDay Load (0.2ms) SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" IS NULL) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1
142
- SQL (0.2ms) INSERT INTO "companies" ("name") VALUES ('The Leftorium')
143
- WorkingDay Load (0.1ms) SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" = 3) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1
144
- SQL (0.1ms) INSERT INTO "working_days" ("created_at", "end_hour", "end_min", "start_hour", "start_min", "updated_at", "week_day", "workable_id", "workable_type") VALUES ('2010-11-19 20:17:39.283311', 18, 45, 8, 30, '2010-11-19 20:17:39.283311', 0, 3, 'ActsAsWorkingDaysTest::Company')
145
- SQL (1.1ms) DELETE FROM "companies" WHERE 1=1
146
- ActsAsWorkingDaysTest::Company Load (0.1ms) SELECT "companies".* FROM "companies"
147
- SQL (0.1ms) DELETE FROM "companies" WHERE 1=1
148
- WorkingDay Load (0.2ms) SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" IS NULL) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1
149
- SQL (0.3ms) INSERT INTO "companies" ("name") VALUES ('Moes Tavern')
150
- WorkingDay Load (0.1ms) SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" = 4) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1
151
- SQL (0.1ms) INSERT INTO "working_days" ("created_at", "end_hour", "end_min", "start_hour", "start_min", "updated_at", "week_day", "workable_id", "workable_type") VALUES ('2010-11-19 20:17:39.294696', 18, 45, 8, 30, '2010-11-19 20:17:39.294696', 0, 4, 'ActsAsWorkingDaysTest::Company')
152
- SQL (0.3ms) SELECT COUNT(*) AS count_id FROM (SELECT 1 FROM "working_days" WHERE ("working_days".workable_id = 4 AND "working_days".workable_type = 'ActsAsWorkingDaysTest::Company') AND (week_day = 0 AND ((start_hour < 12) OR (start_hour = 12 AND start_min <= NULL)) AND ((end_hour > 12) OR (end_hour = 12 AND end_min <= NULL)))) AS subquery
153
- SQL (1.1ms) DELETE FROM "companies" WHERE 1=1
154
- WorkingDay Load (0.2ms) SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" IS NULL) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1
155
- SQL (0.3ms) INSERT INTO "working_days" ("created_at", "end_hour", "end_min", "start_hour", "start_min", "updated_at", "week_day", "workable_id", "workable_type") VALUES ('2010-11-19 20:17:39.304368', 19, 30, 9, 15, '2010-11-19 20:17:39.304368', 0, NULL, 'ActsAsWorkingDaysTest::Company')
156
- WorkingDay Load (0.2ms) SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" IS NULL) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') AND ("working_days".id <> 5) LIMIT 1
157
- SQL (0.3ms) INSERT INTO "companies" ("name") VALUES ('Springfield Nuclear Power Plant')
158
- WorkingDay Load (0.1ms) SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" = 5) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') AND ("working_days".id <> 5) LIMIT 1
159
- SQL (0.1ms) UPDATE "working_days" SET "updated_at" = '2010-11-19 20:17:39.312441', "workable_id" = 5 WHERE ("working_days"."id" = 5)
160
- WorkingDay Load (0.2ms) SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" = 5) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') AND ("working_days".id <> 5) LIMIT 1
161
- SQL (0.3ms) UPDATE "working_days" SET "end_hour" = 16, "end_min" = 15, "start_hour" = 6, "start_min" = 0, "updated_at" = '2010-11-19 20:17:39.317952' WHERE ("working_days"."id" = 5)