← Back to Upcase

End of video 2, using Devise, users not saving to database?


(Justin Davidson) #1

Hey guys! I’m at the end of video 2 for the ‘Shouter’ app, and I’m having a little trouble saving followed_users and followers to the db. I’ve tried to use Devise for authentication instead of Monbon, and believe the create method in my FollowingRelationships can controller is the issue. Anyone else tried to use Devise and find a work around? Here’s the link to my repos. I’ve tried to nut this one out myself but can’t find a solution!! https://github.com/RuNpiXelruN/upcase_intermediate


(Justin Davidson) #2

Sorry to be a pain…but can someone please pull this repos and see why I’m being saved to both sides of the database?? I’ve followed along exactly and can’t work it out? I want to carry on with the rest of the tutorials

Thanks, Justin


(Josh Mills) #3

I believe the issue has to do with what Rails calls strong parameters. You need to whitelist and/or require parameters from the params Hash.

You can see it in the other controllers that do work-as-intended. Just look for the permit keyword in the files.

Here’s a link to the docs: ActionController Parameters


(Justin Davidson) #4

Hey thanks for the reply. I’ve added in the permitted params as suggested but still getting myself put in both the follower and followed user columns. I have a feeling it may be a problem with the create method in my FollowingRelationships Controller. Isn’t this finding me and then adding me to the current_user’s(also me) followed users list?

    user = User.find(params[:user_id)
    current_user.followed_users << user
    redirect_to user
end ```