Skip to content

Instantly share code, notes, and snippets.

@andrewhl
Created December 16, 2011 17:18
Show Gist options
  • Save andrewhl/1486962 to your computer and use it in GitHub Desktop.
Save andrewhl/1486962 to your computer and use it in GitHub Desktop.
# After trying to visit /users/hellhuman:
Couldn't find User with id=hellhuman
Asr::Application.routes.draw do
ActiveAdmin.routes(self)
devise_for :admin_users, ActiveAdmin::Devise.config
devise_for :users
resources :pages
resources :users
resources :admin
resources :manage
match '/manage', :to => 'manage#index'
match '/update', :to => 'manage#update'
match '/contact', :to => 'pages#contact'
match '/home', :to => 'pages#home'
match '/about', :to => 'pages#about'
match '/league', :to => 'pages#league'
match '/results', :to => 'pages#results'
match '/prizes', :to => 'pages#prizes'
match '/news', :to => 'pages#news'
match '/users', :to => 'users#index'
match '/:kgs_names', :to => 'users#show'
root :to => "pages#home"
end
<%= @user.username %>, <%= @user.email %>
<% if user_signed_in? %>
<p>Welcome!</p>
<table>
<tr>
<th>Black Player</th>
<th>White Player</th>
<th>Result</th>
</tr>
<% @games.each do |game| %>
<tr>
<td><%= game.black_player_name %></td>
<td><%= game.white_player_name %></td>
<td><%= game.result %></td>
</tr>
<% end %>
</table>
<% else %>
<p>You're not signed in!</p>
<% end %>
def show
@user = User.find(params[:id])
@games = Match.where("white_player_name = ? or black_player_name = ?", @user.kgs_names, @user.kgs_names)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment