Last active
September 12, 2017 13:20
-
-
Save abhchand/883015f2e39639158ab7dd56b7030b55 to your computer and use it in GitHub Desktop.
Blog Post: The interactor design pattern
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class UsersController < ApplicationController | |
| def create | |
| # Validate the form data and return if | |
| # it is not correct | |
| unless (????) | |
| flash[:error] = ???? | |
| redirect_to(new_users_path) | |
| return | |
| end | |
| user = User.create!(user_params) | |
| flash[:success] = "Woohoo, you created an account" | |
| redirect_to(user_path(@ser)) | |
| end | |
| private | |
| def user_params | |
| @user_params || = params.require(:user).permit( | |
| :first_name, | |
| :last_name, | |
| ) | |
| end | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://abhchand.me/blog/?p=117