ruby - Rails App crashes when Authorizing OmniAuth and Devise on Heroku -


i trying allow users authorize account access github , angel.co. request goes out keep getting error , page crashes. please assist me in trouble shooting issue.

omniauth_callbacks_controller.rb

class omniauthcallbackscontroller < devise::omniauthcallbackscontroller    def     #raise request.env['omniauth.auth'].to_yaml     account = account.from_omniauth(request.env["omniauth.auth"])      if account.persisted?        sign_in_and_redirect account, notice: "signed in!"      else        session["devise.account_attributes"] = account.attributes        redirect_to new_account_registration_url      end   end    alias_method :facebook, :all     alias_method :github, :all   alias_method :angellist, :all   end 

accounts.rb

class account < activerecord::base    devise :database_authenticatable, :registerable, :omniauthable, :validatable, :trackable,      :recoverable, :rememberable #, :confirmable    attr_accessible :email, :password, :password_confirmation, :remember_me    has_many :authorizations       def self.from_omniauth(auth, current_account)    authorization = authorization.where(provider: auth.provider, uid: auth.uid.to_s, token: auth.credentials.token, secret: auth.credentials.secret).first_or_initialize      if authorization.account.blank?        account = current_account.nil? ? account.where('email = ?', auth["info"]["email"]).first : current_account        if account.blank?         account = account.new         account.password = devise.friendly_token[0,10]         account.email = auth.info.email         auth.provider == "github" ?  account.save(validate: false) :  account.save       end       authorization.account.user.name = auth.info.full_name       authorization.account_id = account.id       authorization.save     end     authorization.account   end     def self.new_with_session(params, session)      if session["devise.account_attributes"]         new(session["devise.account_attributes"], without_protection: true) |account|         account.attributes = params         account.valid?      end      else       super      end   end     def password_required?     super     end 

edit.html.erb

<% ['github', 'angellist', 'facebook' ].each |provider| %>               <% if @account.authorizations.pluck(:provider).include?(provider.to_s) %>                    <%= provider.to_s.titleize %> connected                 <% else %>               <%= link_to "sign in #{provider.to_s.titleize}", omniauth_authorize_path('account', provider) %>               <% end %>                 <br/>           <% end %>         </div>      </div> 

error

argumenterror (wrong number of arguments (1 2)): app/models/account.rb:21:in `from_omniauth' app/controllers/omniauth_callbacks_controller.rb:5:in `all'  


Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -