diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 0000000..aa1ef17
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1,12 @@
+# These are supported funding model platforms
+
+github:[excid3]
+patreon: # Replace with a single Patreon username
+open_collective: # Replace with a single Open Collective username
+ko_fi: # Replace with a single Ko-fi username
+tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
+community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
+liberapay: # Replace with a single Liberapay username
+issuehunt: # Replace with a single IssueHunt username
+otechie: # Replace with a single Otechie username
+custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
diff --git a/README.md b/README.md
index 9706474..17f2e16 100644
--- a/README.md
+++ b/README.md
@@ -26,8 +26,16 @@ I created Marketable to automatically track the most basic and important marketi
1) Add 'devise_marketable' to your Gemfile.
+```ruby
+source "https://rubygems.pkg.github.com/excid3" do
+ gem "devise_marketable", "~> 1.0"
+end
```
-gem 'devise_marketable'
+
+Or from the master branch:
+
+```
+gem 'devise_marketable', git: 'https://github.com/excid3/devise_marketable'
```
2) Run `bundle install`
@@ -49,13 +57,7 @@ rails g devise_marketable User
rake db:migrate
```
-5) Make your devise model "marketable"
-
-```
-devise :database_authenticatable, ..., :marketable
-```
-
-6) Restart your server
+5) Restart your server
------------
@@ -63,19 +65,12 @@ Devise will now automatically create 2 cookies for your users, the referring_url
That's it. You now have some very powerful data: where your best customers come from, what traffic sources are your most lucrative, what on your website converts the best, what people are most interested in, etc.
-P.S. [**I'd love to meet you on Twitter: here**](http://twitter.com/natekontny).
-
-
-
-
---------------
Feedback
--------
-[Source code available on Github](https://github.com/n8/devise_marketable). Feedback and pull requests are greatly appreciated. Let me know if I can improve this.
+[Source code available on Github](https://github.com/excid3/devise_marketable). Feedback and pull requests are greatly appreciated. Let me know if I can improve this.
---------------
[Here's a great short presentation from Mike on tracking user metrics](http://vimeo.com/10733370).
-
-
diff --git a/devise_marketable.gemspec b/devise_marketable.gemspec
index bdea98a..ed8d0db 100644
--- a/devise_marketable.gemspec
+++ b/devise_marketable.gemspec
@@ -21,5 +21,5 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "rake"
- spec.add_runtime_dependency "devise"
+ spec.add_runtime_dependency 'devise', '>= 4.0.0'
end
diff --git a/lib/devise_marketable.rb b/lib/devise_marketable.rb
index 160132a..f8ae00f 100644
--- a/lib/devise_marketable.rb
+++ b/lib/devise_marketable.rb
@@ -7,9 +7,9 @@ module DeviseMarketable
module Controller
extend ActiveSupport::Concern
-
+
included do
- before_filter :set_tracking_cookies
+ before_action :set_tracking_cookies, if: ->{ respond_to?(:cookies) }
end
def set_tracking_cookies
@@ -30,7 +30,7 @@ def custom_build_resource(hash = nil)
devise_build_resource(hash)
if devise_mapping.marketable?
- add_marketing_bits
+ add_marketing_bits if respond_to?(:cookies)
end
return self.resource
@@ -54,4 +54,3 @@ class Engine < ::Rails::Engine
end
end
-
diff --git a/lib/generators/devise_marketable/devise_marketable_generator.rb b/lib/generators/devise_marketable/devise_marketable_generator.rb
index 95183fa..0e9d6d8 100644
--- a/lib/generators/devise_marketable/devise_marketable_generator.rb
+++ b/lib/generators/devise_marketable/devise_marketable_generator.rb
@@ -24,7 +24,12 @@ def self.next_migration_number(dirname)
def create_migration_file
- migration_template 'migration.rb', "db/migrate/devise_add_marketable_#{name.downcase}.rb"
+ migration_template 'migration.rb', "db/migrate/devise_add_marketable_#{name.underscore}.rb"
+ end
+
+ def inject_devise_invitable_content
+ path = File.join("app", "models", "#{file_path}.rb")
+ inject_into_file(path, "marketable, :", :after => "devise :") if File.exists?(path)
end
protected