jpmcgrath/shortener

Rails 5 compatibility

0x7466 opened this issue ยท 11 comments

Just wanted to ask if somebody is working on a Rails 5 compatible version?

Please add Rails 5 support. I tried it out anyway and it wasn't working.

Bundler could not find compatible versions for gem "rack":
  In snapshot (Gemfile.lock):
    rack (= 2.0.3)

  In Gemfile:
    rails (~> 5.1.2) was resolved to 5.1.3, which depends on
      actionpack (= 5.1.3) was resolved to 5.1.3, which depends on
        rack (~> 2.0)

    shortener (= 0.6.2) was resolved to 0.6.2, which depends on
      voight_kampff (~> 1.0.2) was resolved to 1.0.2, which depends on
        rack (~> 1.6)

:(

Any progress on this?

@seanfcarroll you can temporary use:

gem 'shortener', github: 'JerryGreen/shortener', branch: 'rails5'

It's not only rails5 support added, though. I removed some dumb code also. it's working for me nicely in production, the tests are not passing though. You can see the difference here:

https://github.com/jpmcgrath/shortener/pull/84/files

Thanks @jerrygreen I'll check it out. I'm using it here https://github.com/crowdAI/crowdai

Any update on the support of Rails 5?

Thanks @jerrygreen for your work on this.

This works fine for me in development (rails 5.1.2, pg 0.21.0) but I'm getting a syntax error when I deploy to Heroku.

app/models/shortener/shortened_url.rb:84: syntax error, unexpected '.' 2017-12-19T22:58:08.309333+00:00 app[web.1]: url = shortened_url&.url || Shortener.default_redirect || '/'

Are you able to push that little fix through? Or can anyone point me to a good resource that explains unpacking or cloning a branch of a gem (which I spent way to much time trying to do) so I can fix it myself?

Update \ Edit: "&." - the safe navigation operator - is new to ruby 2.3.0. While I was using ruby 2.4.1, I did not list my ruby version in gemfile. This fixed it for me.

I have created PR for rails 5.1

I am currently using this with no issue. To use this add this line to Gemfile,

gem 'shortener', github: 'charusat09/shortener', branch: 'rails5'

I have a pull request adds support and tests for Ruby 2.2-2.5 and Rails 4 to Rails 5.2+ here #95.

Thanks to everyone and apologies for the delay on this. Rails5 support was released today (v0.7.1).

i think we need to reopen this due to rails 5 now makes belongs_to relationships required by #default,
see #99