Skip to content

Commit

Permalink
fix alto_guisso_rails requires.
Browse files Browse the repository at this point in the history
update find_or_create_user to support Rails 4.* due to change sin find_or_create_by methods
  • Loading branch information
Brian J. Cardiff committed Nov 29, 2014
1 parent a68fcbb commit 20c177f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/alto_guisso_rails/engine.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require_relative "rails/routes"
require_relative "../../app/helpers/guisso/application_helper"
require_relative "../../app/helpers/alto_guisso_rails/application_helper"
require 'omniauth-openid'
require 'openid/store/filesystem'

class AltoGuissoRails::Railtie < Rails::Railtie
Expand Down
7 changes: 6 additions & 1 deletion lib/alto_guisso_rails/rails/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ def authenticate_api_#{mapping}!
end
def find_or_create_user(email)
user = #{mapping.to_s.capitalize}.find_or_create_by_email(email)
user = if Rails::VERSION::MAJOR >= 4
#{mapping.to_s.capitalize}.find_or_create_by(email: email)
else
#{mapping.to_s.capitalize}.find_or_create_by_email(email)
end
if user.new_record?
user.confirmed_at = Time.now
user.password = Devise.friendly_token
Expand Down

0 comments on commit 20c177f

Please sign in to comment.