| Total Complexity | 5 |
| Total Lines | 25 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | class UsersController < ApplicationController |
||
| 2 | def index |
||
| 3 | @users = User.order('created_at DESC, id DESC') |
||
| 4 | end |
||
| 5 | |||
| 6 | def new |
||
| 7 | @user = User.new |
||
| 8 | end |
||
| 9 | |||
| 10 | def create |
||
| 11 | @user = User.new(user_params) |
||
| 12 | |||
| 13 | if @user.save |
||
| 14 | redirect_to users_url, notice: 'User was created and SMS notification was sent. Check server log for yourself!' |
||
| 15 | else |
||
| 16 | render :new |
||
| 17 | end |
||
| 18 | end |
||
| 19 | |||
| 20 | private |
||
| 21 | |||
| 22 | def user_params |
||
| 23 | params.require(:user).permit(:name, :phone) |
||
| 24 | end |
||
| 25 | end |
||
| 26 |