Skip to content

Instantly share code, notes, and snippets.

@nataliaconde
Last active June 28, 2021 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nataliaconde/46b2556c79b2563e1828cd411711bd3c to your computer and use it in GitHub Desktop.
Save nataliaconde/46b2556c79b2563e1828cd411711bd3c to your computer and use it in GitHub Desktop.
Ruby controller/handler
# sessions_controller.rb
class SessionsController < ApplicationController
def create
@login_form = LoginForm.new(params)
if @user = @login_form.submit
sign_in @user
redirect_to @user, notice: "Welcome!"
else
render action: :new
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment