has_moderated 1.0.alpha2 → 1.0.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. data/README.rdoc +36 -13
  2. data/lib/has_moderated/associations/base.rb +4 -4
  3. data/lib/has_moderated/associations/collection.rb +0 -1
  4. data/lib/has_moderated/carrier_wave.rb +69 -46
  5. data/lib/has_moderated/moderated_create.rb +1 -1
  6. data/lib/has_moderated/moderation_model.rb +7 -3
  7. data/lib/has_moderated/version.rb +1 -1
  8. data/lib/has_moderated.rb +2 -1
  9. data/test/dummy/Guardfile +0 -1
  10. data/test/dummy/app/models/photo.rb +4 -0
  11. data/test/dummy/db/development.sqlite3 +0 -0
  12. data/test/dummy/db/migrate/20120520215008_initial_schema.rb +48 -0
  13. data/test/dummy/db/migrate/20120520215224_create_photos.rb +13 -0
  14. data/test/dummy/db/schema.rb +11 -1
  15. data/test/dummy/db/test.sqlite3 +0 -0
  16. data/test/dummy/log/development.log +56 -0
  17. data/test/dummy/log/test.log +8211 -0
  18. data/test/dummy/public/uploads/{task_photo/photo → photo/avatar}/1/test.jpg +0 -0
  19. data/test/dummy/public/uploads/{task_photo/photo → photo/avatar}/1/thumb_test.jpg +0 -0
  20. data/test/dummy/spec/models/photo_spec.rb +95 -0
  21. data/test/dummy/spec/models/task_spec.rb +74 -4
  22. data/test/dummy/spec/support/photos.rb +6 -2
  23. metadata +15 -79
  24. data/lib/has_moderated/associations/has_many.rb +0 -15
  25. data/test/dummy/db/migrate/20110901013205_create_tasks.rb +0 -10
  26. data/test/dummy/db/migrate/20110901013228_create_subtasks.rb +0 -11
  27. data/test/dummy/db/migrate/20110901013618_create_moderations.rb +0 -15
  28. data/test/dummy/db/migrate/20110908025410_create_task_alls.rb +0 -10
  29. data/test/dummy/db/migrate/20110908025606_add_task_all_id_to_subtasks.rb +0 -5
  30. data/test/dummy/db/migrate/20111003205633_create_photos.rb +0 -9
  31. data/test/dummy/db/migrate/20111003234101_create_task_photos.rb +0 -10
  32. data/test/dummy/db/migrate/20111004153147_create_hook_tests.rb +0 -10
  33. data/test/dummy/db/migrate/20111004164509_create_photo_holders.rb +0 -10
  34. data/test/dummy/db/migrate/20111008195728_create_hone_tests.rb +0 -9
  35. data/test/dummy/db/migrate/20111008195809_create_hjoin_tests.rb +0 -13
  36. data/test/dummy/db/migrate/20111009193145_fix_join_table.rb +0 -8
  37. data/test/dummy/db/migrate/20111009201729_add_title_to_hone_tests.rb +0 -5
  38. data/test/dummy/db/migrate/20111009205517_create_hmanythrough_tests.rb +0 -9
  39. data/test/dummy/db/migrate/20111009205545_create_hmanythrough_joins.rb +0 -11
  40. data/test/dummy/db/migrate/20111018172409_create_hone_as_tests.rb +0 -11
  41. data/test/dummy/db/migrate/20111018174319_create_hmany_fk_tests.rb +0 -10
  42. data/test/dummy/db/migrate/20111018180207_create_habtm_name_tests.rb +0 -13
  43. data/test/dummy/db/migrate/20120209045206_create_photo_relateds.rb +0 -10
  44. data/test/dummy/db/migrate/20120515155730_create_moderations2.rb +0 -20
  45. data/test/dummy/db/migrate/20120515174306_prepare_for_new_tests.rb +0 -36
  46. data/test/dummy/db/migrate/20120515175621_remove_photo_relateds.rb +0 -8
  47. data/test/dummy/spec/factories/habtm_name_tests.rb +0 -7
  48. data/test/dummy/spec/factories/hjoin_tests.rb +0 -7
  49. data/test/dummy/spec/factories/hmany_fk_tests.rb +0 -8
  50. data/test/dummy/spec/factories/hmanythrough_joins.rb +0 -9
  51. data/test/dummy/spec/factories/hmanythrough_tests.rb +0 -7
  52. data/test/dummy/spec/factories/hone_as_tests.rb +0 -9
  53. data/test/dummy/spec/factories/hone_tests.rb +0 -7
  54. data/test/dummy/spec/factories/hook_tests.rb +0 -8
  55. data/test/dummy/spec/factories/photo_holders.rb +0 -7
  56. data/test/dummy/spec/factories/photo_relateds.rb +0 -8
  57. data/test/dummy/spec/factories/photos.rb +0 -7
  58. data/test/dummy/spec/factories/task_alls.rb +0 -8
  59. data/test/dummy/spec/factories/task_photos.rb +0 -7
data/README.rdoc CHANGED
@@ -88,9 +88,13 @@ You can also see moderations for a specific record. For example, if you have Pos
88
88
  post = Post.first
89
89
  post.moderations
90
90
 
91
- Moderation is a normal ActiveRecord model, you can inspect it in rails console to see what it holds. Data is serialized in YAML format and can be deserialized by calling
91
+ Moderation is a normal ActiveRecord model, you can inspect it in rails console to see what it holds. Data is serialized in YAML format
92
92
 
93
- YAML::load(moderation.data)
93
+ moderation.data
94
+
95
+ The data can be deserialized using YAML::load, but this has already been done for you
96
+
97
+ moderation.parsed_data
94
98
 
95
99
  To accept a moderation, call
96
100
 
@@ -139,24 +143,48 @@ This is just one example how you can do it. You need the attr_accessor here beca
139
143
 
140
144
  == CarrierWave support
141
145
 
142
- There is support for CarrierWave uploads to be moderated. You must put this line into the model that has a CarrierWave uploader mounted:
146
+ There is support for CarrierWave uploads to be moderated. If you need some more customization look at this module in lib/has_moderated/carrier_wave.rb and make your own version.
147
+
148
+ === Example of moderating uploads
149
+
150
+ This will moderate the upload no matter if the record is being created, or updated. Other unmoderated fields will be saved normally.
143
151
 
152
+ mount_uploader :avatar, GenericUploader
144
153
  include HasModerated::CarrierWave
154
+ has_moderated_carrierwave_field :avatar
155
+ has_moderated :avatar
145
156
 
146
- Right now *you must use the field name "photo" for the upload filename* because it is currently hardcoded into this module. If you do this, then moderation for the photo should work correctly.
157
+ === Example of moderating create of the whole model using a CarrierWave uploader
147
158
 
148
- It does not matter if this model has any moderation itself or if you just have an association to it from some other model that is moderated. You must include this module in either case, because it ensures proper serialization of the photo information.
149
- If you want to moderate changes to the photo on this model itself (e.g. not only when its associated to something else), add also
159
+ This will moderate creating the whole record (all its fields), including the upload.
150
160
 
151
- has_moderated :carrierwave_photo
161
+ mount_uploader :avatar, GenericUploader
162
+ has_moderated_create
163
+ include HasModerated::CarrierWave
164
+ has_moderated_carrierwave_field :avatar
165
+
166
+ To moderate later changes to the upload (avatar), additionally add
152
167
 
153
- If you need some more customization look at this module in lib/has_moderated/carrier_wave.rb and just copy the methods into your model and customize them (with some care when you do this, some methods should be class methods).
168
+ has_moderated :avatar
169
+
170
+ === Example of moderating on association
171
+
172
+ If you are moderating some other model, and the model with the upload is an association to it, you still need to add this
173
+
174
+ mount_uploader :avatar, GenericUploader
175
+ include HasModerated::CarrierWave
176
+ has_moderated_carrierwave_field :avatar
177
+
178
+ This will only moderate the upload when it's being saved through an association which has
179
+
180
+ has_moderated_association :photos
154
181
 
155
182
  == Tests
156
183
 
157
184
  I've tested this project using RSpec. You can find the tests in
158
185
 
159
186
  test/dummy/spec/models/task_spec.rb
187
+ test/dummy/spec/models/photo_spec.rb
160
188
 
161
189
  You can run the tests by running
162
190
 
@@ -187,11 +215,6 @@ to make it possible to support other than activerecord, use activemodel when its
187
215
 
188
216
  use YARD for docs
189
217
  check again railscasts episodes for gems (e.g. railties)
190
- -
191
-
192
- make hasone, hasmany etc. each a separate "extension" (like carrierwave). for tests just use 2 models (task, subtask) and dont define has_many in model but in test
193
-
194
- Amend moderations... Eg if you create a new record and save it, then change something additionally and save again.
195
218
  Preview method which gives changed object but doesnt save it.
196
219
 
197
220
  == License
@@ -30,14 +30,14 @@ module HasModerated
30
30
  assoc_names.map{ |name| self.reflections[name] }.each do |assoc|
31
31
  case assoc.macro
32
32
  when :has_many then
33
- self.send :extend, HasModerated::Associations::HasMany::ClassMethods
34
- has_moderated_has_many_association(assoc)
33
+ self.send :extend, HasModerated::Associations::Collection::ClassMethods
34
+ has_moderated_collection_association(assoc)
35
35
  when :has_one then
36
36
  self.send :extend, HasModerated::Associations::HasOne::ClassMethods
37
37
  has_moderated_has_one_association(assoc)
38
38
  when :has_and_belongs_to_many then
39
- self.send :extend, HasModerated::Associations::HasMany::ClassMethods
40
- has_moderated_has_many_association(assoc)
39
+ self.send :extend, HasModerated::Associations::Collection::ClassMethods
40
+ has_moderated_collection_association(assoc)
41
41
  else raise "don't know how to moderate association macro #{assoc.macro}"
42
42
  end
43
43
  end
@@ -79,7 +79,6 @@ module HasModerated
79
79
  def self.add_assoc_to_record_hm(to, record, reflection)
80
80
  fk = HasModerated::Adapters::ActiveRecord::foreign_key(reflection).try(:to_s)
81
81
  field = if !reflection.options[:as].blank?
82
- # todo: extract
83
82
  reflection.options[:as].to_s
84
83
  elsif !fk.blank?
85
84
  all_keys = []
@@ -4,10 +4,6 @@ module HasModerated
4
4
 
5
5
  def self.included(base)
6
6
  base.send :extend, ClassMethods
7
- base.send :include, InstanceMethods
8
-
9
- base.alias_method_chain :store_photo!, :moderation
10
- base.alias_method_chain :write_photo_identifier, :moderation
11
7
  end
12
8
 
13
9
  def self.photo_tmp_delete(value)
@@ -29,57 +25,84 @@ module HasModerated
29
25
  end
30
26
 
31
27
  module ClassMethods
28
+ def has_moderated_carrierwave_field field_names
29
+ base = self
30
+ base.send :include, InstanceMethods
31
+
32
+ cattr_accessor :moderated_carrierwave_fields
33
+
34
+ field_names = [field_names] unless field_names.kind_of? Array
35
+
36
+ field_names.each do |field_name|
37
+ field_name = field_name.to_s
38
+ self.moderated_carrierwave_fields ||= []
39
+ self.moderated_carrierwave_fields.push(field_name)
40
+
41
+ base.send :define_method, "#{field_name}_tmp_file=" do |value|
42
+ self.send("#{field_name}=", File.open(value))
43
+ HasModerated::CarrierWave::photo_tmp_delete(value)
44
+ end
45
+
46
+ base.send :define_method, "store_#{field_name}_with_moderation!" do
47
+ is_moderated = self.class.respond_to?(:moderated_attributes) &&
48
+ self.class.moderated_attributes.include?(field_name)
49
+ if !is_moderated || self.moderation_disabled || !self.send("#{field_name}_changed?")
50
+ self.send("store_#{field_name}_without_moderation!")
51
+ else
52
+ self.create_moderation_with_hooks!({
53
+ :attributes => {
54
+ "#{field_name}_tmp_file" => self.send(field_name).file.file
55
+ }
56
+ })
57
+ end
58
+ end
59
+
60
+ base.send :define_method, "write_#{field_name}_identifier_with_moderation" do
61
+ is_moderated = self.class.respond_to?(:moderated_attributes) &&
62
+ self.class.moderated_attributes.include?(field_name)
63
+ if !is_moderated || self.moderation_disabled || !self.send("#{field_name}_changed?")
64
+ self.send("write_#{field_name}_identifier_without_moderation")
65
+ end
66
+ end
67
+
68
+ base.alias_method_chain :get_moderation_attributes, :carrierwave unless base.instance_methods.include?("get_moderation_attributes_without_carrierwave")
69
+ base.alias_method_chain "store_#{field_name}!", :moderation
70
+ base.alias_method_chain "write_#{field_name}_identifier", :moderation
71
+ end
72
+ end
73
+
32
74
  # use class method because we only operate on hash parameters, not with a real record
33
75
  # here we can delete the photo from tmp
34
76
  def moderatable_discard(moderation)
35
- value = moderation.interpreted_value
36
- if moderation.attr_name == "-" && value && value.respond_to?("[]") &&
37
- value[:main_model] && value[:main_model][:photo_tmp_file]
38
- value = value[:main_model][:photo_tmp_file]
39
- elsif moderation.attr_name != "photo_tmp_file"
40
- return # we dont want to process anything else than the above
41
- end
42
-
43
- unless value.blank?
44
- HasModerated::CarrierWave::photo_tmp_delete(value)
77
+ value = moderation.parsed_data
78
+
79
+ moderated_carrierwave_fields.each do |field_name|
80
+ if value.kind_of? Hash
81
+ if value.has_key?(:create) && value[:create].has_key?(:attributes)
82
+ value = value[:create]
83
+ end
84
+ if value.has_key?(:attributes) && value[:attributes].has_key?("#{field_name}_tmp_file")
85
+ value = value[:attributes].send("#{field_name}_tmp_file")
86
+ if value.present?
87
+ HasModerated::CarrierWave::photo_tmp_delete(value)
88
+ end
89
+ else
90
+ return # we dont want to process anything else than the above
91
+ end
92
+ end
45
93
  end
46
94
  end
47
95
  end
48
96
 
49
97
  module InstanceMethods
50
- attr_accessor :moderation_disabled # in case this model itself is not moderated
51
- # maybe autodetect fields that use carrierwave, or specify them
52
- def moderatable_hashize
53
- attrs = self.attributes
54
- attrs = attrs.merge({
55
- :photo_tmp_file => self.photo.file.file
56
- }) if self.photo && self.photo.file
57
- end
58
-
59
- def photo_tmp_file=(value)
60
- self.photo = File.open(value)
61
- HasModerated::CarrierWave::photo_tmp_delete(value)
62
- end
63
-
64
- def store_photo_with_moderation!
65
- is_moderated = self.class.respond_to?(:moderated_attributes) &&
66
- self.class.moderated_attributes.include?("carrierwave_photo")
67
- if self.moderation_disabled || !is_moderated || !self.photo_changed?
68
- store_photo_without_moderation!
69
- else
70
- self.moderations.create!({
71
- :attr_name => "photo_tmp_file",
72
- :attr_value => self.photo.file.file
73
- })
74
- end
75
- end
76
-
77
- def write_photo_identifier_with_moderation
78
- is_moderated = self.class.respond_to?(:moderated_attributes) &&
79
- self.class.moderated_attributes.include?("carrierwave_photo")
80
- if self.moderation_disabled || !is_moderated || !self.photo_changed?
81
- write_photo_identifier_without_moderation
98
+ def get_moderation_attributes_with_carrierwave
99
+ attrs = get_moderation_attributes_without_carrierwave
100
+ self.class.moderated_carrierwave_fields.each do |field_name|
101
+ attrs = attrs.merge({
102
+ "#{field_name}_tmp_file" => self.send(field_name).file.file
103
+ }) if self.send(field_name) && self.send(field_name).file
82
104
  end
105
+ attrs
83
106
  end
84
107
  end
85
108
  end
@@ -26,7 +26,7 @@ module HasModerated
26
26
  rec.send(key.to_s+"=", val) unless key.to_s == 'id'
27
27
  end
28
28
  rec.without_moderation { rec.save(:validate => false) }
29
- moderation.moderatable = rec
29
+ moderation.moderatable = rec # just so associations can be applied in next line
30
30
  HasModerated::Associations::Base::ApplyModeration::apply(moderation, value[:create])
31
31
  end
32
32
  end
@@ -1,10 +1,14 @@
1
1
  module HasModerated
2
2
  module ModerationModel
3
+ def parsed_data
4
+ @parsed_data ||= YAML::load(data)
5
+ end
6
+
3
7
  def accept
4
- loaded_val = YAML::load(data)
5
- HasModerated::Associations::Base::ApplyModeration::apply(self, loaded_val)
6
- HasModerated::ModeratedAttributes::ApplyModeration::apply(self, loaded_val)
8
+ loaded_val = parsed_data
7
9
  HasModerated::ModeratedCreate::ApplyModeration::apply(self, loaded_val)
10
+ HasModerated::ModeratedAttributes::ApplyModeration::apply(self, loaded_val)
11
+ HasModerated::Associations::Base::ApplyModeration::apply(self, loaded_val)
8
12
  HasModerated::ModeratedDestroy::ApplyModeration::apply(self, loaded_val)
9
13
  self.destroy
10
14
  end
@@ -1,3 +1,3 @@
1
1
  module HasModerated
2
- VERSION = "1.0.alpha2"
2
+ VERSION = "1.0.beta"
3
3
  end
data/lib/has_moderated.rb CHANGED
@@ -7,13 +7,14 @@ require 'has_moderated/adapters/active_record'
7
7
  require 'has_moderated/associations/base'
8
8
  require 'has_moderated/associations/has_one'
9
9
  require 'has_moderated/associations/collection'
10
- require 'has_moderated/associations/has_many'
11
10
 
12
11
 
13
12
  require 'has_moderated/moderated_attributes'
14
13
  require 'has_moderated/moderated_create'
15
14
  require 'has_moderated/moderated_destroy'
16
15
 
16
+ require 'has_moderated/carrier_wave'
17
+
17
18
  module HasModerated
18
19
  def self.included(base)
19
20
  HasModerated::Common::included(base)
data/test/dummy/Guardfile CHANGED
@@ -5,7 +5,6 @@ guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAIL
5
5
  watch(%r{^config/initializers/.+\.rb$})
6
6
  watch('Gemfile')
7
7
  watch('Gemfile.lock')
8
- watch('../../lib/has_moderated/associations/base.rb')
9
8
  watch('spec/spec_helper.rb') { :rspec }
10
9
  watch('test/test_helper.rb') { :test_unit }
11
10
  watch(%r{features/support/}) { :cucumber }
@@ -0,0 +1,4 @@
1
+ class Photo < ActiveRecord::Base
2
+ mount_uploader :avatar, GenericUploader
3
+ mount_uploader :picture, GenericUploader
4
+ end
Binary file
@@ -0,0 +1,48 @@
1
+ class InitialSchema < ActiveRecord::Migration
2
+ def change
3
+ create_table "moderations", :force => true do |t|
4
+ t.integer "moderatable_id"
5
+ t.string "moderatable_type"
6
+ t.text "data", :null => false
7
+ t.datetime "created_at", :null => false
8
+ t.datetime "updated_at", :null => false
9
+ end
10
+
11
+ create_table "subtasks", :force => true do |t|
12
+ t.integer "task_id"
13
+ t.string "title"
14
+ t.string "desc"
15
+ t.datetime "created_at"
16
+ t.datetime "updated_at"
17
+ t.integer "parentable_id"
18
+ t.string "parentable_type"
19
+ end
20
+
21
+ create_table "task_connections", :force => true do |t|
22
+ t.string "title"
23
+ t.integer "m1_id"
24
+ t.integer "m2_id"
25
+ t.datetime "created_at", :null => false
26
+ t.datetime "updated_at", :null => false
27
+ end
28
+
29
+ create_table "task_photos", :force => true do |t|
30
+ t.string "photo"
31
+ t.integer "task_id"
32
+ t.datetime "created_at"
33
+ t.datetime "updated_at"
34
+ end
35
+
36
+ create_table "tasks", :force => true do |t|
37
+ t.string "title"
38
+ t.string "desc"
39
+ t.datetime "created_at"
40
+ t.datetime "updated_at"
41
+ end
42
+
43
+ create_table "tasks_jointable", :id => false, :force => true do |t|
44
+ t.integer "m1_id"
45
+ t.integer "m2_id"
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,13 @@
1
+ class CreatePhotos < ActiveRecord::Migration
2
+ def change
3
+ create_table :photos do |t|
4
+ t.string :avatar
5
+ t.string :picture
6
+ t.integer :parentable_id
7
+ t.string :parentable_type
8
+ t.string :title
9
+
10
+ t.timestamps
11
+ end
12
+ end
13
+ end
@@ -10,7 +10,7 @@
10
10
  #
11
11
  # It's strongly recommended to check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema.define(:version => 20120515175621) do
13
+ ActiveRecord::Schema.define(:version => 20120520215224) do
14
14
 
15
15
  create_table "moderations", :force => true do |t|
16
16
  t.integer "moderatable_id"
@@ -20,6 +20,16 @@ ActiveRecord::Schema.define(:version => 20120515175621) do
20
20
  t.datetime "updated_at", :null => false
21
21
  end
22
22
 
23
+ create_table "photos", :force => true do |t|
24
+ t.string "avatar"
25
+ t.string "picture"
26
+ t.integer "parentable_id"
27
+ t.string "parentable_type"
28
+ t.string "title"
29
+ t.datetime "created_at", :null => false
30
+ t.datetime "updated_at", :null => false
31
+ end
32
+
23
33
  create_table "subtasks", :force => true do |t|
24
34
  t.integer "task_id"
25
35
  t.string "title"
Binary file
@@ -7472,3 +7472,59 @@ Migrating to CreateModerations2 (20120515155730)
7472
7472
  DEPRECATION WARNING: ActiveSupport::Memoizable is deprecated and will be removed in future releases,simply use Ruby memoization pattern instead. (called from /Users/apple/rails/has_moderated/test/dummy/config/environment.rb:5)
7473
7473
  DEPRECATION WARNING: ActiveSupport::Memoizable is deprecated and will be removed in future releases,simply use Ruby memoization pattern instead. (called from /Users/apple/rails/has_moderated/test/dummy/config/environment.rb:5)
7474
7474
  DEPRECATION WARNING: ActiveSupport::Memoizable is deprecated and will be removed in future releases,simply use Ruby memoization pattern instead. (called from /Users/apple/rails/has_moderated/test/dummy/config/environment.rb:5)
7475
+ DEPRECATION WARNING: ActiveSupport::Memoizable is deprecated and will be removed in future releases,simply use Ruby memoization pattern instead. (called from /Users/apple/rails/has_moderated/test/dummy/config/environment.rb:5)
7476
+ DEPRECATION WARNING: ActiveSupport::Memoizable is deprecated and will be removed in future releases,simply use Ruby memoization pattern instead. (called from /Users/apple/rails/has_moderated/test/dummy/config/environment.rb:5)
7477
+ DEPRECATION WARNING: ActiveSupport::Memoizable is deprecated and will be removed in future releases,simply use Ruby memoization pattern instead. (called from /Users/apple/rails/has_moderated/test/dummy/config/environment.rb:5)
7478
+  (0.2ms) select sqlite_version(*)
7479
+  (1.8ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
7480
+  (0.1ms) PRAGMA index_list("schema_migrations")
7481
+  (1.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
7482
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
7483
+ Migrating to InitialSchema (20120520215008)
7484
+  (0.0ms) begin transaction
7485
+  (0.4ms) CREATE TABLE "moderations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "moderatable_id" integer, "moderatable_type" varchar(255), "data" text NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
7486
+  (0.3ms) CREATE TABLE "subtasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "task_id" integer, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime, "parentable_id" integer, "parentable_type" varchar(255))
7487
+  (0.1ms) CREATE TABLE "task_connections" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "m1_id" integer, "m2_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
7488
+  (0.1ms) CREATE TABLE "task_photos" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "photo" varchar(255), "task_id" integer, "created_at" datetime, "updated_at" datetime)
7489
+  (0.1ms) CREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime) 
7490
+  (0.1ms) CREATE TABLE "tasks_jointable" ("m1_id" integer, "m2_id" integer)
7491
+  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120520215008')
7492
+  (1.6ms) commit transaction
7493
+  (0.1ms) select sqlite_version(*)
7494
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
7495
+  (0.1ms) PRAGMA index_list("moderations")
7496
+  (0.0ms) PRAGMA index_list("subtasks")
7497
+  (0.0ms) PRAGMA index_list("task_connections")
7498
+  (0.0ms) PRAGMA index_list("task_photos")
7499
+  (0.0ms) PRAGMA index_list("tasks")
7500
+  (0.0ms) PRAGMA index_list("tasks_jointable")
7501
+ DEPRECATION WARNING: ActiveSupport::Memoizable is deprecated and will be removed in future releases,simply use Ruby memoization pattern instead. (called from /Users/apple/rails/has_moderated/test/dummy/config/environment.rb:5)
7502
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
7503
+ Migrating to InitialSchema (20120520215008)
7504
+  (0.1ms) select sqlite_version(*)
7505
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
7506
+  (0.0ms) PRAGMA index_list("moderations")
7507
+  (0.0ms) PRAGMA index_list("subtasks")
7508
+  (0.0ms) PRAGMA index_list("task_connections")
7509
+  (0.0ms) PRAGMA index_list("task_photos")
7510
+  (0.0ms) PRAGMA index_list("tasks")
7511
+  (0.0ms) PRAGMA index_list("tasks_jointable")
7512
+ DEPRECATION WARNING: ActiveSupport::Memoizable is deprecated and will be removed in future releases,simply use Ruby memoization pattern instead. (called from /Users/apple/rails/has_moderated/test/dummy/config/environment.rb:5)
7513
+ DEPRECATION WARNING: ActiveSupport::Memoizable is deprecated and will be removed in future releases,simply use Ruby memoization pattern instead. (called from /Users/apple/rails/has_moderated/test/dummy/config/environment.rb:5)
7514
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
7515
+ Migrating to InitialSchema (20120520215008)
7516
+ Migrating to CreatePhotos (20120520215224)
7517
+  (0.0ms) select sqlite_version(*)
7518
+  (0.0ms) begin transaction
7519
+  (0.5ms) CREATE TABLE "photos" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "avatar" varchar(255), "picture" varchar(255), "parentable_id" integer, "parentable_type" varchar(255), "title" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
7520
+  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120520215224')
7521
+  (2.8ms) commit transaction
7522
+  (0.1ms) select sqlite_version(*)
7523
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
7524
+  (0.0ms) PRAGMA index_list("moderations")
7525
+  (0.0ms) PRAGMA index_list("photos")
7526
+  (0.0ms) PRAGMA index_list("subtasks")
7527
+  (0.0ms) PRAGMA index_list("task_connections")
7528
+  (0.0ms) PRAGMA index_list("task_photos")
7529
+  (0.0ms) PRAGMA index_list("tasks")
7530
+  (0.0ms) PRAGMA index_list("tasks_jointable")