Search code examples
ruby-on-railsember.jsdeviseember-simple-auth

Rails and Ember Simple Auth


Now I'm learning Ember and have a simple Ruby on Rails app with Devise.
I do everything by this manual. But it doesn't work.
So I've found this issue: #387 and pull-request where my problem is maybe fixed #394.

So my question is how to get changes from master branch.
Now I do this in such way:

# Gemfile
source 'https://rails-assets.org'
gem 'rails-assets-ember-simple-auth'

But I don't know how to get latest changes. Also I tried to download repo to vendor folder but Rails doesn't support ES6.

P.S. Now I have made some changes to make it working in Rails but it's not a good way

# application_controller.rb
def authenticate_user_from_token!
  authenticate_with_http_token do |token, options|
    user_email = options[:user_email].presence
    user = user_email && User.find_by_email(user_email)
    token = token.split('"').last

    if user && Devise.secure_compare(user.authentication_token, token)
      sign_in user, store: false
    end
  end
end

Solution

  • Until the next version of Ember Simple Auth is released you can simply keep this quick fix and remove it later.