mailkick 0.1.4 → 1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0bf0541ba51746a50f8a286d7acd0bed58660b4b
4
- data.tar.gz: 796d78becdc4f302b06dd1eb7bf44df154fd9e6f
2
+ SHA256:
3
+ metadata.gz: e84a6786c23946b6e27a67a14d75c01da5cde231928d19c65edd2b591de9a153
4
+ data.tar.gz: 1a944d065c7bf4c164db038aabe0073b3759e96a232ec22b29e86cf746ffc02f
5
5
  SHA512:
6
- metadata.gz: da32468a31c92c6e674eb1b397827d155c01bd918ade637c9145702b92c35ebb39c916eee01c680efad85ac1b2d298ad2b4b9bb2033bd1d04dfab67baca8e58c
7
- data.tar.gz: 11cbb1e1b2cce5d3763cb11517892d010240ad24e467ff3a2f9b9d8f1d69a1320ab8efd777093edaf328ba1241495bf2f50303d39e82b5333e35dd49b8b130bd
6
+ metadata.gz: 3ed9f0315dc5c60ed5b2cc524fd13763566b6126bafceb665dbddcdc2a182f4408a370e267fdcc8ab97cbe616684c7ff5ab91b0fe717d39a65deac854cd3b958
7
+ data.tar.gz: 82c2c1d7a1d0077eb60df59a9d672039b17750462a435afdef19125e26f3c122600a2a8f394c06a3119a64c773d4a6ef7a1f61dc5081dca587735eda80c4a9c3
data/CHANGELOG.md CHANGED
@@ -1,46 +1,107 @@
1
- ## 0.1.4
1
+ ## 1.0.1 (2021-06-20)
2
+
3
+ - Fixed error message when process out-opts not configured
4
+
5
+ ## 1.0.0 (2021-06-03)
6
+
7
+ - Switched from opt-outs to subscriptions
8
+ - Dropped support for Ruby < 2.6 and Rails < 5.2
9
+
10
+ ## 0.4.3 (2020-11-01)
11
+
12
+ - Added support for AWS SES
13
+
14
+ ## 0.4.2 (2020-04-06)
15
+
16
+ - Added support for official SendGrid gem
17
+ - Fixed deprecation warning
18
+
19
+ ## 0.4.1 (2019-10-27)
20
+
21
+ - Added Postmark support
22
+
23
+ ## 0.4.0 (2019-07-15)
24
+
25
+ - Fixed error with model methods and `email_key` option
26
+ - Fixed bug with `opted_out` scope
27
+ - Dropped support for Action Mailer 4.2
28
+
29
+ ## 0.3.1 (2018-04-21)
30
+
31
+ - Fixed `Secret should not be nil` error in Rails 5.2
32
+ - Gracefully handle missing email
33
+ - Added `user` option to `mailkick_unsubscribe_url`
34
+
35
+ ## 0.3.0 (2018-04-20)
36
+
37
+ - Improved performance
38
+ - Fixed `Subscription not found` for Rails 5.2
39
+ - Use `references` in migration
40
+ - Use `smtp_settings[:domain]` for Mailgun
41
+ - Dropped support for Action Mailer < 4.2
42
+
43
+ ## 0.2.1 (2017-10-30)
44
+
45
+ - Fixed errors with Rails 5+
46
+ - Fixed errors with the latest version of Gibbon
47
+
48
+ ## 0.2.0 (2017-05-01)
49
+
50
+ - Added support for Rails 5.1
51
+
52
+ ## 0.1.6 (2017-01-10)
53
+
54
+ - Fixed error with frozen strings
55
+
56
+ ## 0.1.5 (2016-12-06)
57
+
58
+ - Use `safely`
59
+ - Only discover services if not manually set
60
+ - Added `mount` option
61
+
62
+ ## 0.1.4 (2016-02-20)
2
63
 
3
64
  - Use `Module#prepend` instead of `alias_method_chain`
4
65
 
5
- ## 0.1.3
66
+ ## 0.1.3 (2015-06-29)
6
67
 
7
68
  - Fixed issue with double escaping tokens
8
69
 
9
- ## 0.1.2
70
+ ## 0.1.2 (2015-06-07)
10
71
 
11
72
  - Added support for Mailgun
12
73
 
13
- ## 0.1.1
74
+ ## 0.1.1 (2015-01-31)
14
75
 
15
76
  - Fixed tokens with `+` in them
16
77
 
17
- ## 0.1.0
78
+ ## 0.1.0 (2014-08-31)
18
79
 
19
80
  - Fixed secret token for Rails 4.1
20
81
 
21
- ## 0.0.6
82
+ ## 0.0.6 (2014-05-09)
22
83
 
23
84
  - Rails 3 fix
24
85
 
25
- ## 0.0.5
86
+ ## 0.0.5 (2014-05-05)
26
87
 
27
88
  - Fixed bug with subscriptions page
28
89
 
29
- ## 0.0.4
90
+ ## 0.0.4 (2014-05-05)
30
91
 
31
92
  - Added `email_key` option to `mailkick_user`
32
93
 
33
- ## 0.0.3
94
+ ## 0.0.3 (2014-05-04)
34
95
 
35
96
  - Added support for multiple lists
36
97
  - Changed `mailkick_user` method names - sorry early adopters :(
37
98
 
38
- ## 0.0.2
99
+ ## 0.0.2 (2014-05-04)
39
100
 
40
101
  - Added Mailchimp service
41
102
  - Fixed Mandrill service
42
103
  - Added `uniq` to `subscribed` scope
43
104
 
44
- ## 0.0.1
105
+ ## 0.0.1 (2014-05-04)
45
106
 
46
107
  - First release
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014 Andrew Kane
1
+ Copyright (c) 2014-2021 Andrew Kane
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,14 +1,16 @@
1
1
  # Mailkick
2
2
 
3
- :bullettrain_side: Email subscriptions made easy
3
+ Email subscriptions for Rails
4
4
 
5
5
  - Add one-click unsubscribe links to your emails
6
6
  - Fetch bounces and spam reports from your email service
7
7
 
8
- Gracefully handles email address changes
8
+ **Mailkick 1.0 was recently released** - see [how to upgrade](#upgrading)
9
9
 
10
10
  :postbox: Check out [Ahoy Email](https://github.com/ankane/ahoy_email) for analytics
11
11
 
12
+ [![Build Status](https://github.com/ankane/mailkick/workflows/build/badge.svg?branch=master)](https://github.com/ankane/mailkick/actions)
13
+
12
14
  ## Installation
13
15
 
14
16
  Add this line to your application’s Gemfile:
@@ -17,205 +19,249 @@ Add this line to your application’s Gemfile:
17
19
  gem 'mailkick'
18
20
  ```
19
21
 
20
- And run the generator. This creates a model to store opt-outs.
22
+ And run the generator. This creates a table to store subscriptions.
21
23
 
22
24
  ```sh
25
+ bundle install
23
26
  rails generate mailkick:install
24
- rake db:migrate
27
+ rails db:migrate
25
28
  ```
26
29
 
27
- ## How It Works
28
-
29
- Add an unsubscribe link to your emails.
30
+ ## Getting Started
30
31
 
31
- #### Text
32
+ Add `has_subscriptions` to your user model:
32
33
 
33
- ```erb
34
- Unsubscribe: <%= mailkick_unsubscribe_url %>
34
+ ```ruby
35
+ class User < ApplicationRecord
36
+ has_subscriptions
37
+ end
35
38
  ```
36
39
 
37
- #### HTML
40
+ Subscribe to a list
38
41
 
39
- ```erb
40
- <%= link_to "Unsubscribe", mailkick_unsubscribe_url %>
42
+ ```ruby
43
+ user.subscribe("sales")
41
44
  ```
42
45
 
43
- When a user unsubscribes, he or she is taken to a mobile-friendly page and given the option to resubscribe.
44
-
45
- To customize the view, run:
46
+ Unsubscribe from a list
46
47
 
47
- ```sh
48
- rails generate mailkick:views
48
+ ```ruby
49
+ user.unsubscribe("sales")
49
50
  ```
50
51
 
51
- which copies the view into `app/views/mailkick`.
52
-
53
- ## Sending Emails
52
+ Check if subscribed
54
53
 
55
- Before sending marketing emails, make sure the user has not opted out.
54
+ ```ruby
55
+ user.subscribed?("sales")
56
+ ```
56
57
 
57
- Add the following method to models with email addresses.
58
+ Get subscribers for a list (use this for sending emails)
58
59
 
59
60
  ```ruby
60
- class User < ActiveRecord::Base
61
- mailkick_user
62
- end
61
+ User.subscribed("sales")
63
62
  ```
64
63
 
65
- Get all users who have opted out
64
+ ## Unsubscribe Links
66
65
 
67
- ```ruby
68
- User.opted_out
66
+ Add an unsubscribe link to your emails. For HTML emails, use:
67
+
68
+ ```erb
69
+ <%= link_to "Unsubscribe", mailkick_unsubscribe_url(@user, "sales") %>
69
70
  ```
70
71
 
71
- And those who have not - send to these people
72
+ For text emails, use:
72
73
 
73
- ```ruby
74
- User.not_opted_out
74
+ ```erb
75
+ Unsubscribe: <%= mailkick_unsubscribe_url(@user, "sales") %>
75
76
  ```
76
77
 
77
- Check one user
78
+ When a user unsubscribes, they are taken to a mobile-friendly page and given the option to resubscribe. To customize the view, run:
78
79
 
79
- ```ruby
80
- user.opted_out?
80
+ ```sh
81
+ rails generate mailkick:views
81
82
  ```
82
83
 
84
+ which copies the view into `app/views/mailkick`.
85
+
83
86
  ## Bounces and Spam Reports
84
87
 
85
- Fetch bounces, spam reports, and unsubscribes from your email service.
88
+ Fetch bounces, spam reports, and unsubscribes from your email service. Create `config/initializers/mailkick.rb` with a method to handle opt outs.
86
89
 
87
90
  ```ruby
88
- Mailkick.fetch_opt_outs
89
- ```
91
+ Mailkick.process_opt_outs_method = lambda do |opt_outs|
92
+ emails = opt_outs.map { |v| v[:email] }
93
+ subscribers = User.includes(:mailkick_subscriptions).where(email: emails).index_by(&:email)
90
94
 
91
- #### Sendgrid
95
+ opt_outs.each do |opt_out|
96
+ subscriber = subscribers[opt_out[:email]]
97
+ next unless subscriber
92
98
 
93
- Add the gem
99
+ subscriber.mailkick_subscriptions.each do |subscription|
100
+ subscription.destroy if subscription.created_at < opt_out[:time]
101
+ end
102
+ end
103
+ end
104
+ ```
105
+
106
+ And run:
94
107
 
95
108
  ```ruby
96
- gem 'sendgrid_toolkit'
109
+ Mailkick.fetch_opt_outs
97
110
  ```
98
111
 
99
- Be sure `ENV["SENDGRID_USERNAME"]` and `ENV["SENDGRID_PASSWORD"]` are set.
112
+ The following services are supported:
100
113
 
101
- #### Mandrill
114
+ - [AWS SES](#aws-ses)
115
+ - [Mailchimp](#mailchimp)
116
+ - [Mailgun](#mailgun)
117
+ - [Mandrill](#mandrill)
118
+ - [Postmark](#postmark)
119
+ - [SendGrid](#sendgrid)
120
+
121
+ Will gladly accept pull requests for others.
122
+
123
+ #### AWS SES
124
+
125
+ Add the gem
102
126
 
103
127
  ```ruby
104
- gem 'mandrill-api'
128
+ gem 'aws-sdk-sesv2'
105
129
  ```
106
130
 
107
- Be sure `ENV["MANDRILL_APIKEY"]` is set.
131
+ And [configure your AWS credentials](https://github.com/aws/aws-sdk-ruby#configuration). Requires `ses:ListSuppressedDestinations` permission.
132
+
133
+ If you started using Amazon SES [before November 25, 2019](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/sending-email-suppression-list.html#sending-email-suppression-list-considerations), you have to manually [enable account-level suppression list feature](https://docs.aws.amazon.com/ses/latest/APIReference-V2/API_PutAccountSuppressionAttributes.html).
108
134
 
109
135
  #### Mailchimp
110
136
 
137
+ Add the gem
138
+
111
139
  ```ruby
112
- gem 'gibbon'
140
+ gem 'gibbon', '>= 2'
113
141
  ```
114
142
 
115
- Be sure `ENV["MAILCHIMP_API_KEY"]` and `ENV["MAILCHIMP_LIST_ID"]` are set.
143
+ And set `ENV["MAILCHIMP_API_KEY"]` and `ENV["MAILCHIMP_LIST_ID"]`.
116
144
 
117
145
  #### Mailgun
118
146
 
147
+ Add the gem
148
+
119
149
  ```ruby
120
150
  gem 'mailgun-ruby'
121
151
  ```
122
152
 
123
- Be sure `ENV["MAILGUN_API_KEY"]` is set.
153
+ And set `ENV["MAILGUN_API_KEY"]`.
124
154
 
125
- #### Other
126
-
127
- Will gladly accept pull requests.
128
-
129
- ### Advanced
155
+ #### Mandrill
130
156
 
131
- For more control over services, set them by hand.
157
+ Add the gem
132
158
 
133
159
  ```ruby
134
- Mailkick.services = [
135
- Mailkick::Service::Sendgrid.new(api_key: "API_KEY"),
136
- Mailkick::Service::Mandrill.new(api_key: "API_KEY")
137
- ]
160
+ gem 'mandrill-api'
138
161
  ```
139
162
 
140
- ## Multiple Lists [beta]
163
+ And set `ENV["MANDRILL_APIKEY"]`.
141
164
 
142
- You may want to split your emails into multiple categories, like sale emails and order reminders.
165
+ #### Postmark
143
166
 
144
- Set the list in the mailer.
167
+ Add the gem
145
168
 
146
169
  ```ruby
147
- class UserMailer < ActionMailer::Base
170
+ gem 'postmark'
171
+ ```
148
172
 
149
- def order_reminder(user)
150
- headers[:mailkick_list] = "order_reminders"
151
- # ...
152
- end
173
+ And set `ENV["POSTMARK_API_KEY"]`.
153
174
 
154
- end
155
- ```
175
+ #### SendGrid
156
176
 
157
- Pass the `list` option to methods.
177
+ Add the gem
158
178
 
159
179
  ```ruby
160
- User.opted_out(list: "order_reminders")
161
- User.not_opted_out(list: "order_reminders")
162
- user.opted_out?(list: "order_reminders")
180
+ gem 'sendgrid-ruby'
163
181
  ```
164
182
 
165
- ### Opt-In Lists
183
+ And set `ENV["SENDGRID_API_KEY"]`. The API key requires only the `Suppressions` permission.
166
184
 
167
- For opt-in lists, you’ll need to manage the subscribers yourself.
185
+ ### Advanced
168
186
 
169
- Check opt-ins against the opt-outs
187
+ For more control over services, set them by hand.
170
188
 
171
189
  ```ruby
172
- User.where(send_me_sales: true).not_opted_out(list: "sales")
190
+ Mailkick.services = [
191
+ Mailkick::Service::SendGridV2.new(api_key: "API_KEY"),
192
+ Mailkick::Service::Mailchimp.new(api_key: "API_KEY", list_id: "LIST_ID")
193
+ ]
173
194
  ```
174
195
 
175
- Check one user
196
+ ## Reference
197
+
198
+ Access the subscription model directly
176
199
 
177
200
  ```ruby
178
- user.send_me_sales && !user.opted_out?(list: "sales")
201
+ Mailkick::Subscription.all
179
202
  ```
180
203
 
181
- ## Bonus
182
-
183
- More great gems for email
204
+ ## Upgrading
184
205
 
185
- - [Roadie](https://github.com/Mange/roadie) - inline CSS
186
- - [Letter Opener](https://github.com/ryanb/letter_opener) - preview email in development
206
+ ### 1.0
187
207
 
188
- ## TODO
208
+ Mailkick 1.0 stores subscriptions instead of opt-outs. To migrate:
189
209
 
190
- - Make it easy to customize controller
191
- - Subscribe to events
210
+ 1. Add a table to store subscriptions
192
211
 
193
- ## Reference
212
+ ```sh
213
+ rails generate mailkick:install
214
+ rails db:migrate
215
+ ```
194
216
 
195
- Change how the user is determined
217
+ 2. Change the following methods in your code:
196
218
 
197
- ```ruby
198
- Mailkick.user_method = proc {|email| User.where(email: email).first }
199
- ```
219
+ - `mailkick_user` to `has_subscriptions`
220
+ - `User.not_opted_out` to `User.subscribed(list)`
221
+ - `opt_in` to `subscribe(list)`
222
+ - `opt_out` to `unsubscribe(list)`
200
223
 
201
- Use a different email field
224
+ 3. Add a user and list to `mailkick_unsubscribe_url`
202
225
 
203
226
  ```ruby
204
- mailkick_user email_key: :email_address
227
+ mailkick_unsubscribe_url(user, list)
205
228
  ```
206
229
 
207
- Unsubscribe
230
+ 4. Migrate data for each of your lists
208
231
 
209
232
  ```ruby
210
- user.opt_out
233
+ opted_out_emails = Mailkick::Legacy.opted_out_emails(list: nil)
234
+ opted_out_users = Mailkick::Legacy.opted_out_users(list: nil)
235
+
236
+ User.find_in_batches do |users|
237
+ users.reject! { |u| opted_out_emails.include?(u.email) }
238
+ users.reject! { |u| opted_out_users.include?(u) }
239
+
240
+ now = Time.now
241
+ records =
242
+ users.map do |user|
243
+ {
244
+ subscriber_type: user.class.name,
245
+ subscriber_id: user.id,
246
+ list: "sales",
247
+ created_at: now,
248
+ updated_at: now
249
+ }
250
+ end
251
+
252
+ # use create! for Active Record < 6
253
+ Mailkick::Subscription.insert_all!(records)
254
+ end
211
255
  ```
212
256
 
213
- Resubscribe
257
+ 5. Drop the `mailkick_opt_outs` table
214
258
 
215
259
  ```ruby
216
- user.opt_in
260
+ drop_table :mailkick_opt_outs
217
261
  ```
218
262
 
263
+ Also, if you use `Mailkick.fetch_opt_outs`, [add a method](#bounces-and-spam-reports) to handle opt outs.
264
+
219
265
  ## History
220
266
 
221
267
  View the [changelog](https://github.com/ankane/mailkick/blob/master/CHANGELOG.md)
@@ -228,3 +274,12 @@ Everyone is encouraged to help improve this project. Here are a few ways you can
228
274
  - Fix bugs and [submit pull requests](https://github.com/ankane/mailkick/pulls)
229
275
  - Write, clarify, or fix documentation
230
276
  - Suggest or add new features
277
+
278
+ To get started with development and testing:
279
+
280
+ ```sh
281
+ git clone https://github.com/ankane/mailkick.git
282
+ cd mailkick
283
+ bundle install
284
+ bundle exec rake test
285
+ ```
@@ -1,42 +1,51 @@
1
1
  module Mailkick
2
2
  class SubscriptionsController < ActionController::Base
3
- before_filter :set_email
3
+ protect_from_forgery with: :exception
4
+
5
+ before_action :set_subscription
4
6
 
5
7
  def show
6
8
  end
7
9
 
8
10
  def unsubscribe
9
- Mailkick.opt_out(@options)
11
+ subscription.delete_all
12
+
13
+ Mailkick::Legacy.opt_out(legacy_options) if Mailkick::Legacy.opt_outs?
14
+
10
15
  redirect_to subscription_path(params[:id])
11
16
  end
12
17
 
13
18
  def subscribe
14
- Mailkick.opt_in(@options)
19
+ subscription.first_or_create!
20
+
21
+ Mailkick::Legacy.opt_in(legacy_options) if Mailkick::Legacy.opt_outs?
22
+
15
23
  redirect_to subscription_path(params[:id])
16
24
  end
17
25
 
18
26
  protected
19
27
 
20
- def set_email
21
- verifier = ActiveSupport::MessageVerifier.new(Mailkick.secret_token)
22
- begin
23
- @email, user_id, user_type, @list = verifier.verify(params[:id])
24
- if user_type
25
- # on the unprobabilistic chance user_type is compromised, not much damage
26
- @user = user_type.constantize.find(user_id)
27
- end
28
- @options = {
29
- email: @email,
30
- user: @user,
31
- list: @list
32
- }
33
- rescue ActiveSupport::MessageVerifier::InvalidSignature
34
- render text: "Subscription not found", status: :bad_request
35
- end
28
+ def set_subscription
29
+ @email, @subscriber_id, @subscriber_type, @list = Mailkick.message_verifier.verify(params[:id])
30
+ rescue ActiveSupport::MessageVerifier::InvalidSignature
31
+ render plain: "Subscription not found", status: :bad_request
36
32
  end
37
33
 
34
+ def subscription
35
+ Mailkick::Subscription.where(
36
+ subscriber_id: @subscriber_id,
37
+ subscriber_type: @subscriber_type,
38
+ list: @list
39
+ )
40
+ end
41
+
42
+ def subscribed?
43
+ subscription.exists?
44
+ end
45
+ helper_method :subscribed?
46
+
38
47
  def opted_out?
39
- Mailkick.opted_out?(@options)
48
+ !subscribed?
40
49
  end
41
50
  helper_method :opted_out?
42
51
 
@@ -49,5 +58,17 @@ module Mailkick
49
58
  unsubscribe_subscription_path(params[:id])
50
59
  end
51
60
  helper_method :unsubscribe_url
61
+
62
+ def legacy_options
63
+ if @subscriber_type
64
+ # on the unprobabilistic chance subscriber_type is compromised, not much damage
65
+ user = @subscriber_type.constantize.find(@subscriber_id)
66
+ end
67
+ {
68
+ email: @email,
69
+ user: user,
70
+ list: @list
71
+ }
72
+ end
52
73
  end
53
74
  end
@@ -2,6 +2,6 @@ module Mailkick
2
2
  class OptOut < ActiveRecord::Base
3
3
  self.table_name = "mailkick_opt_outs"
4
4
 
5
- belongs_to :user, polymorphic: true
5
+ belongs_to :user, polymorphic: true, optional: true
6
6
  end
7
7
  end
@@ -0,0 +1,9 @@
1
+ module Mailkick
2
+ class Subscription < ActiveRecord::Base
3
+ self.table_name = "mailkick_subscriptions"
4
+
5
+ belongs_to :subscriber, polymorphic: true
6
+
7
+ validates :list, presence: true
8
+ end
9
+ end
@@ -24,7 +24,7 @@
24
24
  </head>
25
25
  <body>
26
26
  <div class="container">
27
- <% if opted_out? %>
27
+ <% if !subscribed? %>
28
28
  <p>You are unsubscribed.</p>
29
29
  <p><%= link_to "Resubscribe", subscribe_url %></p>
30
30
  <% else %>
data/config/routes.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  Rails.application.routes.draw do
2
- mount Mailkick::Engine => "/mailkick"
2
+ unless respond_to?(:has_named_route?) && has_named_route?("mailkick")
3
+ mount Mailkick::Engine => "/mailkick" if Mailkick.mount
4
+ end
3
5
  end
4
6
 
5
7
  Mailkick::Engine.routes.draw do
@@ -1,28 +1,17 @@
1
- # taken from https://github.com/collectiveidea/audited/blob/master/lib/generators/audited/install_generator.rb
2
- require "rails/generators"
3
- require "rails/generators/migration"
4
- require "active_record"
5
1
  require "rails/generators/active_record"
6
2
 
7
3
  module Mailkick
8
4
  module Generators
9
5
  class InstallGenerator < Rails::Generators::Base
10
- include Rails::Generators::Migration
6
+ include ActiveRecord::Generators::Migration
7
+ source_root File.join(__dir__, "templates")
11
8
 
12
- source_root File.expand_path("../templates", __FILE__)
13
-
14
- # Implement the required interface for Rails::Generators::Migration.
15
- def self.next_migration_number(dirname) #:nodoc:
16
- next_migration_number = current_migration_number(dirname) + 1
17
- if ActiveRecord::Base.timestamped_migrations
18
- [Time.now.utc.strftime("%Y%m%d%H%M%S"), "%.14d" % next_migration_number].max
19
- else
20
- "%.3d" % next_migration_number
21
- end
9
+ def copy_migration
10
+ migration_template "install.rb", "db/migrate/create_mailkick_subscriptions.rb", migration_version: migration_version
22
11
  end
23
12
 
24
- def copy_migration
25
- migration_template "install.rb", "db/migrate/install_mailkick.rb"
13
+ def migration_version
14
+ "[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]"
26
15
  end
27
16
  end
28
17
  end