Created
February 24, 2015 00:35
-
-
Save kareemgrant/fef5c760803fd7506c24 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
<h1>Here's some info about one user:</h1> | |
<ul> | |
<li>Id: <%= @user.id %></li> | |
<li>Name: <%= @user.name %></li> | |
<li>Email: <%= @user.email %></li> | |
<li>Phone: <%= @user.phone %></li> | |
</ul> | |
<h3>Posts</h3> | |
<ul> | |
<% @posts.each do |post| %> | |
<li><%= post.title %></li> | |
<% end %> | |
</ul> |
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 index | |
@users = User.all | |
end | |
def show | |
@user = User.find_by_id(params[:id]) | |
@posts = @user.posts | |
end | |
def destroy | |
@user = User.find_by_id(params[:id]) | |
@student.destroy | |
flash[:notice] = "This user was deleted." | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment