shortener 0.7.2 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f83263f62775a48c270b4d54188ad42b61f33180
4
- data.tar.gz: 1a942c5240508df45fd79872054c2378af3fdf8f
3
+ metadata.gz: 0ff66256668eb71d5b42010c191233c7346c2651
4
+ data.tar.gz: f4cf3ffadd4b4f74ae6076be7f9fa13edf55b5ea
5
5
  SHA512:
6
- metadata.gz: 327d337f3a099622a910aa5b840ccff3dc397968452879fa2e061d54f2e969611da8f1a0a5c8ea557b58ad7dd32fd1e6f726de97a5d64c4067f7f067a5dea2db
7
- data.tar.gz: e4ab931bd972959a8a95eaa8cddfe973a00b57ed4cb5712c6e03c7e640fcd9f1d840b8c7ca6026b4c84175bb9b8b545b74aa1f91ff81e4686892b28c404f3ee1
6
+ metadata.gz: c88fd4cda719d6759af9f1faa5fc70829f18ff99662f77dc10ae33f20e9debcfabd051c5fe7157a75b505f45d164752cd40ead26ed110be6c09c1427e81e382e
7
+ data.tar.gz: 0e4ae113ede69db12a0b9901747bb20bb0ed4a72e51817e619524c166cc8cf1a8159f69c0352af843a48650773c3aa98e62d92a44f5e5ffcbcfd083265a0c629
@@ -60,17 +60,16 @@ migration:
60
60
  * A unique alphanumeric code of generated for each shortened link, this means that we can get more unique combinations than if we just used numbers;
61
61
  * The link records a count of how many times it has been “un-shortened”;
62
62
  * The link can be associated with a user, this allows for stats of the link usage for a particular user and other interesting things;
63
- * The controller spawns a new thread to record information to the database, allowing the redirect to happen as quickly as possible;
64
63
 
65
64
  === Future improvements:
66
65
 
67
66
  * There has not been an attempt to remove ambiguous characters (i.e. 1 l and capital i, or 0 and O etc.) from the unique key generated for the link. This means people might copy the link incorrectly if copying the link by hand;
68
67
  * The system could pre-generate unique keys in advance, avoiding the database penalty when checking that a newly generated key is unique;
69
- * The system could store the shortened URL if the url is to be continually rendered;
68
+ * The system could store/cache the shortened URL if the url is to be continually rendered;
70
69
 
71
70
  == Installation
72
71
 
73
- Shortener is compatible with Rails v3 and v4. To install, add to your Gemfile:
72
+ Shortener is compatible with Rails v3, v4 & v5. To install, add to your Gemfile:
74
73
 
75
74
  gem 'shortener'
76
75
 
@@ -7,7 +7,12 @@ class Shortener::ShortenedUrl < ActiveRecord::Base
7
7
  before_create :generate_unique_key
8
8
 
9
9
  # allows the shortened link to be associated with a user
10
- belongs_to :owner, polymorphic: true
10
+ if ActiveRecord::VERSION::MAJOR >= 5
11
+ # adds rails 5 compatibility to have nil values as owner
12
+ belongs_to :owner, polymorphic: true, optional: true
13
+ else
14
+ belongs_to :owner, polymorphic: true
15
+ end
11
16
 
12
17
  # exclude records in which expiration time is set and expiration time is greater than current time
13
18
  scope :unexpired, -> { where(arel_table[:expires_at].eq(nil).or(arel_table[:expires_at].gt(::Time.current.to_s(:db)))) }
@@ -1,3 +1,3 @@
1
1
  module Shortener
2
- VERSION = '0.7.2'
2
+ VERSION = '0.8.0'.freeze
3
3
  end
@@ -0,0 +1,11 @@
1
+ # This file extends the new Rails (aka version 5) framework default initializers.
2
+ # It sets the application defaults therefore and because of this dummy application
3
+ # supports new version should contain this file.
4
+ # It isn't adding all defaults as the rails 5 does because of 5.1 and 5.2
5
+ # contains different settings, therefore, it is scoping the settings that this gem
6
+ # requires.
7
+ if ActiveRecord::VERSION::MAJOR >= 5
8
+ # Require `belongs_to` associations by default. Previous versions had false.
9
+ Rails.application.config.active_record.belongs_to_required_by_default = true
10
+ end
11
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shortener
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James P. McGrath
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-05-01 00:00:00.000000000 Z
12
+ date: 2018-07-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: voight_kampff
@@ -174,6 +174,7 @@ files:
174
174
  - spec/dummy/config/initializers/backtrace_silencers.rb
175
175
  - spec/dummy/config/initializers/inflections.rb
176
176
  - spec/dummy/config/initializers/mime_types.rb
177
+ - spec/dummy/config/initializers/new_framework_default.rb
177
178
  - spec/dummy/config/initializers/secret_token.rb
178
179
  - spec/dummy/config/initializers/session_store.rb
179
180
  - spec/dummy/config/locales/en.yml