mailboxer_multi_attach 0.0.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.
Files changed (84) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +7 -0
  3. data/.ruby-version +1 -0
  4. data/Gemfile +17 -0
  5. data/Gemfile.lock +160 -0
  6. data/MIT-LICENSE +20 -0
  7. data/README.md +17 -0
  8. data/README.rdoc +18 -0
  9. data/Rakefile +31 -0
  10. data/app/models/message_attachment.rb +8 -0
  11. data/app/models/messageable.rb +34 -0
  12. data/app/uploaders/message_file_uploader.rb +5 -0
  13. data/db/migrate/20151123194517_create_message_attachments.rb +10 -0
  14. data/lib/generators/mailboxer_multi_attach/install_generator.rb +22 -0
  15. data/lib/generators/mailboxer_multi_attach/templates/create_message_attachments.rb +10 -0
  16. data/lib/mailboxer_multi_attach/version.rb +3 -0
  17. data/lib/mailboxer_multi_attach.rb +7 -0
  18. data/lib/tasks/mailboxer_multi_attach_tasks.rake +4 -0
  19. data/mailboxer_multi_attach.gemspec +28 -0
  20. data/spec/dummy/Gemfile +5 -0
  21. data/spec/dummy/Gemfile.lock +113 -0
  22. data/spec/dummy/README.rdoc +261 -0
  23. data/spec/dummy/Rakefile +7 -0
  24. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  25. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  26. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  27. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  28. data/spec/dummy/app/mailers/.gitkeep +0 -0
  29. data/spec/dummy/app/models/.gitkeep +0 -0
  30. data/spec/dummy/app/models/message_attachment.rb +3 -0
  31. data/spec/dummy/app/models/user.rb +7 -0
  32. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  33. data/spec/dummy/app/views/mailboxer/message_mailer/new_message_email.html.erb +20 -0
  34. data/spec/dummy/app/views/mailboxer/message_mailer/new_message_email.text.erb +10 -0
  35. data/spec/dummy/app/views/mailboxer/message_mailer/reply_message_email.html.erb +20 -0
  36. data/spec/dummy/app/views/mailboxer/message_mailer/reply_message_email.text.erb +10 -0
  37. data/spec/dummy/app/views/mailboxer/notification_mailer/new_notification_email.html.erb +20 -0
  38. data/spec/dummy/app/views/mailboxer/notification_mailer/new_notification_email.text.erb +10 -0
  39. data/spec/dummy/config/application.rb +60 -0
  40. data/spec/dummy/config/boot.rb +10 -0
  41. data/spec/dummy/config/database.yml +25 -0
  42. data/spec/dummy/config/environment.rb +5 -0
  43. data/spec/dummy/config/environments/development.rb +37 -0
  44. data/spec/dummy/config/environments/production.rb +67 -0
  45. data/spec/dummy/config/environments/test.rb +37 -0
  46. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  47. data/spec/dummy/config/initializers/inflections.rb +15 -0
  48. data/spec/dummy/config/initializers/mailboxer.rb +21 -0
  49. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  50. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  51. data/spec/dummy/config/initializers/session_store.rb +8 -0
  52. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  53. data/spec/dummy/config/locales/en.yml +5 -0
  54. data/spec/dummy/config/routes.rb +58 -0
  55. data/spec/dummy/config.ru +4 -0
  56. data/spec/dummy/db/development.sqlite3 +0 -0
  57. data/spec/dummy/db/migrate/20151123025448_create_users.rb +10 -0
  58. data/spec/dummy/db/migrate/20151123152908_create_mailboxer.mailboxer_engine.rb +66 -0
  59. data/spec/dummy/db/migrate/20151123152909_add_conversation_optout.mailboxer_engine.rb +15 -0
  60. data/spec/dummy/db/migrate/20151123152910_add_missing_indices.mailboxer_engine.rb +20 -0
  61. data/spec/dummy/db/migrate/20151123235316_create_message_attachments.rb +10 -0
  62. data/spec/dummy/db/schema.rb +83 -0
  63. data/spec/dummy/db/test.sqlite3 +0 -0
  64. data/spec/dummy/lib/assets/.gitkeep +0 -0
  65. data/spec/dummy/log/.gitkeep +0 -0
  66. data/spec/dummy/log/development.log +372 -0
  67. data/spec/dummy/log/test.log +4181 -0
  68. data/spec/dummy/public/404.html +26 -0
  69. data/spec/dummy/public/422.html +26 -0
  70. data/spec/dummy/public/500.html +25 -0
  71. data/spec/dummy/public/favicon.ico +0 -0
  72. data/spec/dummy/public/uploads/testfile.txt +1 -0
  73. data/spec/dummy/public/uploads/tmp/1448318001-52723-7553/testfile.txt +1 -0
  74. data/spec/dummy/public/uploads/tmp/1448377714-90292-0212/testfile.txt +1 -0
  75. data/spec/dummy/script/rails +6 -0
  76. data/spec/dummy/spec/models/message_attachment_spec.rb +5 -0
  77. data/spec/dummy/spec/models/user_spec.rb +5 -0
  78. data/spec/factories/user.rb +10 -0
  79. data/spec/mailboxer_multi_attach_spec.rb +0 -0
  80. data/spec/models/message_attachment_spec.rb +15 -0
  81. data/spec/models/messageable_spec.rb +19 -0
  82. data/spec/spec_helper.rb +40 -0
  83. data/spec/testfile.txt +1 -0
  84. metadata +339 -0
@@ -0,0 +1,37 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Configure static asset server for tests with Cache-Control for performance
11
+ config.serve_static_assets = true
12
+ config.static_cache_control = "public, max-age=3600"
13
+
14
+ # Log error messages when you accidentally call methods on nil
15
+ config.whiny_nils = true
16
+
17
+ # Show full error reports and disable caching
18
+ config.consider_all_requests_local = true
19
+ config.action_controller.perform_caching = false
20
+
21
+ # Raise exceptions instead of rendering exception templates
22
+ config.action_dispatch.show_exceptions = false
23
+
24
+ # Disable request forgery protection in test environment
25
+ config.action_controller.allow_forgery_protection = false
26
+
27
+ # Tell Action Mailer not to deliver emails to the real world.
28
+ # The :test delivery method accumulates sent emails in the
29
+ # ActionMailer::Base.deliveries array.
30
+ config.action_mailer.delivery_method = :test
31
+
32
+ # Raise exception on mass assignment protection for Active Record models
33
+ config.active_record.mass_assignment_sanitizer = :strict
34
+
35
+ # Print deprecation notices to the stderr
36
+ config.active_support.deprecation = :stderr
37
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,15 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
11
+ #
12
+ # These inflection rules are supported but not enabled by default:
13
+ # ActiveSupport::Inflector.inflections do |inflect|
14
+ # inflect.acronym 'RESTful'
15
+ # end
@@ -0,0 +1,21 @@
1
+ Mailboxer.setup do |config|
2
+
3
+ #Configures if you application uses or not email sending for Notifications and Messages
4
+ config.uses_emails = true
5
+
6
+ #Configures the default from for emails sent for Messages and Notifications
7
+ config.default_from = "no-reply@mailboxer.com"
8
+
9
+ #Configures the methods needed by mailboxer
10
+ config.email_method = :mailboxer_email
11
+ config.name_method = :name
12
+
13
+ #Configures if you use or not a search engine and which one you are using
14
+ #Supported engines: [:solr,:sphinx]
15
+ config.search_enabled = false
16
+ config.search_engine = :solr
17
+
18
+ #Configures maximum length of the message subject and body
19
+ config.subject_max_length = 255
20
+ config.body_max_length = 32000
21
+ end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ Dummy::Application.config.secret_token = '40d16cc731068c9573cf1a955b9ba1605d813b584ac66b4fc4632f1cafe55a76bd3323b0e25de90145f0ceb2406873e9f179d8cadb1cb4ad37b94cf3d0c9253b'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # Dummy::Application.config.session_store :active_record_store
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json]
9
+ end
10
+
11
+ # Disable root element in JSON by default.
12
+ ActiveSupport.on_load(:active_record) do
13
+ self.include_root_in_json = false
14
+ end
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -0,0 +1,58 @@
1
+ Dummy::Application.routes.draw do
2
+ # The priority is based upon order of creation:
3
+ # first created -> highest priority.
4
+
5
+ # Sample of regular route:
6
+ # match 'products/:id' => 'catalog#view'
7
+ # Keep in mind you can assign values other than :controller and :action
8
+
9
+ # Sample of named route:
10
+ # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
11
+ # This route can be invoked with purchase_url(:id => product.id)
12
+
13
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
14
+ # resources :products
15
+
16
+ # Sample resource route with options:
17
+ # resources :products do
18
+ # member do
19
+ # get 'short'
20
+ # post 'toggle'
21
+ # end
22
+ #
23
+ # collection do
24
+ # get 'sold'
25
+ # end
26
+ # end
27
+
28
+ # Sample resource route with sub-resources:
29
+ # resources :products do
30
+ # resources :comments, :sales
31
+ # resource :seller
32
+ # end
33
+
34
+ # Sample resource route with more complex sub-resources
35
+ # resources :products do
36
+ # resources :comments
37
+ # resources :sales do
38
+ # get 'recent', :on => :collection
39
+ # end
40
+ # end
41
+
42
+ # Sample resource route within a namespace:
43
+ # namespace :admin do
44
+ # # Directs /admin/products/* to Admin::ProductsController
45
+ # # (app/controllers/admin/products_controller.rb)
46
+ # resources :products
47
+ # end
48
+
49
+ # You can have the root of your site routed with "root"
50
+ # just remember to delete public/index.html.
51
+ # root :to => 'welcome#index'
52
+
53
+ # See how all your routes lay out with "rake routes"
54
+
55
+ # This is a legacy wild controller route that's not recommended for RESTful applications.
56
+ # Note: This route will make all actions in every controller accessible via GET requests.
57
+ # match ':controller(/:action(/:id))(.:format)'
58
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Dummy::Application
Binary file
@@ -0,0 +1,10 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :users do |t|
4
+ t.string :name
5
+ t.string :email
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,66 @@
1
+ # This migration comes from mailboxer_engine (originally 20110511145103)
2
+ class CreateMailboxer < ActiveRecord::Migration
3
+ def self.up
4
+ #Tables
5
+ #Conversations
6
+ create_table :mailboxer_conversations do |t|
7
+ t.column :subject, :string, :default => ""
8
+ t.column :created_at, :datetime, :null => false
9
+ t.column :updated_at, :datetime, :null => false
10
+ end
11
+ #Receipts
12
+ create_table :mailboxer_receipts do |t|
13
+ t.references :receiver, :polymorphic => true
14
+ t.column :notification_id, :integer, :null => false
15
+ t.column :is_read, :boolean, :default => false
16
+ t.column :trashed, :boolean, :default => false
17
+ t.column :deleted, :boolean, :default => false
18
+ t.column :mailbox_type, :string, :limit => 25
19
+ t.column :created_at, :datetime, :null => false
20
+ t.column :updated_at, :datetime, :null => false
21
+ end
22
+ #Notifications and Messages
23
+ create_table :mailboxer_notifications do |t|
24
+ t.column :type, :string
25
+ t.column :body, :text
26
+ t.column :subject, :string, :default => ""
27
+ t.references :sender, :polymorphic => true
28
+ t.column :conversation_id, :integer
29
+ t.column :draft, :boolean, :default => false
30
+ t.string :notification_code, :default => nil
31
+ t.references :notified_object, :polymorphic => true
32
+ t.column :attachment, :string
33
+ t.column :updated_at, :datetime, :null => false
34
+ t.column :created_at, :datetime, :null => false
35
+ t.boolean :global, default: false
36
+ t.datetime :expires
37
+ end
38
+
39
+
40
+ #Indexes
41
+ #Conversations
42
+ #Receipts
43
+ add_index "mailboxer_receipts","notification_id"
44
+
45
+ #Messages
46
+ add_index "mailboxer_notifications","conversation_id"
47
+
48
+ #Foreign keys
49
+ #Conversations
50
+ #Receipts
51
+ add_foreign_key "mailboxer_receipts", "mailboxer_notifications", :name => "receipts_on_notification_id", :column => "notification_id"
52
+ #Messages
53
+ add_foreign_key "mailboxer_notifications", "mailboxer_conversations", :name => "notifications_on_conversation_id", :column => "conversation_id"
54
+ end
55
+
56
+ def self.down
57
+ #Tables
58
+ remove_foreign_key "mailboxer_receipts", :name => "receipts_on_notification_id"
59
+ remove_foreign_key "mailboxer_notifications", :name => "notifications_on_conversation_id"
60
+
61
+ #Indexes
62
+ drop_table :mailboxer_receipts
63
+ drop_table :mailboxer_conversations
64
+ drop_table :mailboxer_notifications
65
+ end
66
+ end
@@ -0,0 +1,15 @@
1
+ # This migration comes from mailboxer_engine (originally 20131206080416)
2
+ class AddConversationOptout < ActiveRecord::Migration
3
+ def self.up
4
+ create_table :mailboxer_conversation_opt_outs do |t|
5
+ t.references :unsubscriber, :polymorphic => true
6
+ t.references :conversation
7
+ end
8
+ add_foreign_key "mailboxer_conversation_opt_outs", "mailboxer_conversations", :name => "mb_opt_outs_on_conversations_id", :column => "conversation_id"
9
+ end
10
+
11
+ def self.down
12
+ remove_foreign_key "mailboxer_conversation_opt_outs", :name => "mb_opt_outs_on_conversations_id"
13
+ drop_table :mailboxer_conversation_opt_outs
14
+ end
15
+ end
@@ -0,0 +1,20 @@
1
+ # This migration comes from mailboxer_engine (originally 20131206080417)
2
+ class AddMissingIndices < ActiveRecord::Migration
3
+ def change
4
+ # We'll explicitly specify its name, as the auto-generated name is too long and exceeds 63
5
+ # characters limitation.
6
+ add_index :mailboxer_conversation_opt_outs, [:unsubscriber_id, :unsubscriber_type],
7
+ name: 'index_mailboxer_conversation_opt_outs_on_unsubscriber_id_type'
8
+ add_index :mailboxer_conversation_opt_outs, :conversation_id
9
+
10
+ add_index :mailboxer_notifications, :type
11
+ add_index :mailboxer_notifications, [:sender_id, :sender_type]
12
+
13
+ # We'll explicitly specify its name, as the auto-generated name is too long and exceeds 63
14
+ # characters limitation.
15
+ add_index :mailboxer_notifications, [:notified_object_id, :notified_object_type],
16
+ name: 'index_mailboxer_notifications_on_notified_object_id_and_type'
17
+
18
+ add_index :mailboxer_receipts, [:receiver_id, :receiver_type]
19
+ end
20
+ end
@@ -0,0 +1,10 @@
1
+ class CreateMessageAttachments < ActiveRecord::Migration
2
+ def change
3
+ create_table :mailboxer_message_attachments do |t|
4
+ t.string :file
5
+ t.integer :message_id
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,83 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended to check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(:version => 20151123235316) do
15
+
16
+ create_table "mailboxer_conversation_opt_outs", :force => true do |t|
17
+ t.integer "unsubscriber_id"
18
+ t.string "unsubscriber_type"
19
+ t.integer "conversation_id"
20
+ end
21
+
22
+ add_index "mailboxer_conversation_opt_outs", ["conversation_id"], :name => "index_mailboxer_conversation_opt_outs_on_conversation_id"
23
+ add_index "mailboxer_conversation_opt_outs", ["unsubscriber_id", "unsubscriber_type"], :name => "index_mailboxer_conversation_opt_outs_on_unsubscriber_id_type"
24
+
25
+ create_table "mailboxer_conversations", :force => true do |t|
26
+ t.string "subject", :default => ""
27
+ t.datetime "created_at", :null => false
28
+ t.datetime "updated_at", :null => false
29
+ end
30
+
31
+ create_table "mailboxer_message_attachments", :force => true do |t|
32
+ t.string "file"
33
+ t.integer "message_id"
34
+ t.datetime "created_at", :null => false
35
+ t.datetime "updated_at", :null => false
36
+ end
37
+
38
+ create_table "mailboxer_notifications", :force => true do |t|
39
+ t.string "type"
40
+ t.text "body"
41
+ t.string "subject", :default => ""
42
+ t.integer "sender_id"
43
+ t.string "sender_type"
44
+ t.integer "conversation_id"
45
+ t.boolean "draft", :default => false
46
+ t.string "notification_code"
47
+ t.integer "notified_object_id"
48
+ t.string "notified_object_type"
49
+ t.string "attachment"
50
+ t.datetime "updated_at", :null => false
51
+ t.datetime "created_at", :null => false
52
+ t.boolean "global", :default => false
53
+ t.datetime "expires"
54
+ end
55
+
56
+ add_index "mailboxer_notifications", ["conversation_id"], :name => "index_mailboxer_notifications_on_conversation_id"
57
+ add_index "mailboxer_notifications", ["notified_object_id", "notified_object_type"], :name => "index_mailboxer_notifications_on_notified_object_id_and_type"
58
+ add_index "mailboxer_notifications", ["sender_id", "sender_type"], :name => "index_mailboxer_notifications_on_sender_id_and_sender_type"
59
+ add_index "mailboxer_notifications", ["type"], :name => "index_mailboxer_notifications_on_type"
60
+
61
+ create_table "mailboxer_receipts", :force => true do |t|
62
+ t.integer "receiver_id"
63
+ t.string "receiver_type"
64
+ t.integer "notification_id", :null => false
65
+ t.boolean "is_read", :default => false
66
+ t.boolean "trashed", :default => false
67
+ t.boolean "deleted", :default => false
68
+ t.string "mailbox_type", :limit => 25
69
+ t.datetime "created_at", :null => false
70
+ t.datetime "updated_at", :null => false
71
+ end
72
+
73
+ add_index "mailboxer_receipts", ["notification_id"], :name => "index_mailboxer_receipts_on_notification_id"
74
+ add_index "mailboxer_receipts", ["receiver_id", "receiver_type"], :name => "index_mailboxer_receipts_on_receiver_id_and_receiver_type"
75
+
76
+ create_table "users", :force => true do |t|
77
+ t.string "name"
78
+ t.string "email"
79
+ t.datetime "created_at", :null => false
80
+ t.datetime "updated_at", :null => false
81
+ end
82
+
83
+ end
Binary file
File without changes
File without changes