I have an existing web application using Rails 3.2.x and Devise 3.2.2. When I type
> rake routes | grep sign_in
I get
new_user_session GET /users/sign_in(.:format) devise#new
user_session POST /users/sign_in(.:format) devise#create
My web application has a few URLs pointing to it. e.g. www.foo.com, www.bar.com, and www.foobar.com all point to the same web application. When a user signs in (and therefore the system calls devise#create), I would like to be able to save the host url into the User model. (I have already adjusted the model to have a field called host_with_port). The controller code should look something like:
current_user.host_with_port = request.host_with_port
My question. I would like to run this at the start or end of the run of the devise controller (where I still have access to request.host). How do I do that? Do I have to write a new class? New routes?
Aucun commentaire:
Enregistrer un commentaire