Possible to pass a record through Rails redirect_to?
I'm attempting to manage user sign ups and log in with omniauth. I'd also
like to collect more information about users after they authorize with the
provider. At the moment Vendor#from_omniauth returns either an existing
vendor or a new Vendor record with their auth hashes already populated. Is
it possible to pass along the new record to the Vendor controller so the
form can easily use it?
I'm using Rails 4.
class SessionsController < ApplicationController
def create
vendor = Vendor.from_omniauth(env["omniauth.auth"])
if vendor.new_record?
redirect_to new_vendor_url(vendor)
else
session[:vendor_id] = vendor.id
redirect_to root_url, notice: "Signed in!"
end
end
end
No comments:
Post a Comment