RailsCasts Pro episodes are now free!

Learn more or hide this

Jeffrey Lee's Profile

GitHub User: jleecbd

Comments by Jeffrey Lee


Sorry, I hadn't come back to look as I had found some solutions. There is another omniauth rails cast, pre-identity.

I actually ended up going the user as identity route, as multi-authentication with identity seems to cause problems. I followed this page as well for assistance: http://bernardi.me/2012/09/using-multiple-omniauth-providers-with-omniauth-identity-on-the-main-user-model/

That said, I'm currently running into a password validation bug, where I'm getting a undefined method `to_sym' for nil:NilClass in the lambda being called in the omniauth identity initializer in the event of a failed authentication. I'll be happy if and when I figure that out.


Here is my password_resets controller code, in case this is still a problem:

def update
@user = User.find_by_password_reset_token!(params[:id])
@identity = Identity.find(@user.id)
if @user.password_reset_sent_at < 2.hours.ago
redirect_to new_password_reset_path, :alert => "Password ↵
reset has expired."
elsif @identity.update_attributes(params[:identity])
redirect_to root_url, :notice => "Password has been reset."
render :edit


I'm a little bit confused. Previously you made all Omniauth authentication options exist via the authentication model. Here you seem to have broken from that by making the user the authentication provider holder. Why isn't identity just another authentication?

The challenge I see is that I want to manage roles for a user, but with the user constructed the way that it is, it would appear I have to create another variation of a user model in order to do make a user a truly singular entity (with many users instead of authentications? both users and authentications?)


Okay, figured that out quickly enough. Just used << to append one array to the other.


Here's my newb question. I'd like to search the a related table on multiple attributes, so in the case of comments, search on the content as well as maybe the submitter. However, I'm not sure how to do the mapping to grab two attributes and concatenate them or join them in one array.