Created
March 19, 2014 10:51
-
-
Save shosanna/9639362 to your computer and use it in GitHub Desktop.
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 ContactsController < ApplicationController | |
| def new | |
| @user = User.new | |
| end | |
| def create | |
| @user = User.new | |
| @user.first_name = params[:first_name] | |
| @user.last_name = params[:last_name] | |
| @user.phone = params[:phone] | |
| @user.admin = params[:admin] | |
| @user.owner = params[:owner] | |
| @user.save! | |
| redirect_to contacts_index_path | |
| end | |
| def index | |
| @users = User.all | |
| end | |
| end |
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
| <h1>User Manager</h1> | |
| <p>Listing all users </p> | |
| <table> | |
| <tr> | |
| <td> First name </td> | |
| <td> Last name </td> | |
| <td> Phone </td> | |
| <td> Sex </td> | |
| <td> Owner </td> | |
| <td> Admin </td> | |
| </tr> | |
| <tr> | |
| <% @users.all do |user| %> | |
| <td> <%= user.first_name %> </td> | |
| <td> <%= user.last_name %> </td> | |
| <td> <%= user.phone %> </td> | |
| <td> <%= user.sex %> </td> | |
| <td> <%= user.owner %> </td> | |
| <td> <%= user.admins %> </td> | |
| <% end %> | |
| </tr> | |
| </table> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment