Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

omniauth and devise

I am looking for a good CLEAR way to add Facebook AND twitter to a Rails 4 application using Devise! Is there any good documentation out there that walks you through the process?

1 Answer

For Rails 4 and Devise:

It's tricky for me as I'm a noob. It's a two part solution for the controller page.
Documentation is on Devise itself... but I'll be the first to say they could break it down easier for newbies like me. Of course they also say "Devise may not be the best for newbies" on their page too.

Works for me, FYI, I use a :profile_name here and you may not

class ApplicationController < ActionController::Base
    # Prevent CSRF attacks by raising an exception.
  # For APIs, you may want to use :null_session instead.
  protect_from_forgery with: :exception

  before_filter :configure_permitted_parameters, if: :devise_controller?


protected

  def configure_permitted_parameters
    devise_parameter_sanitizer.for(:sign_up) { |u| u.permit( :first_name, :last_name, :profile_name, :password_confirmation, :password, :email ) }
    devise_parameter_sanitizer.for(:sign_in) { |u| u.permit( :profile_name, :password, :email ) }
  end

end