Skip to content

Commit

Permalink
readme!
Browse files Browse the repository at this point in the history
  • Loading branch information
Blair Anderson committed Mar 28, 2015
1 parent 5ff5dd2 commit e96a80d
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 9 deletions.
45 changes: 44 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,48 @@ I think this is why wordpress is SO popular. Its stupid-easy to fire-up, and cha

[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy)

### Changing the Code!!!
### Change the Code!!!

My main goal for this is to give new programmers some code to look at and talk about. Anytime i [get questions](/issues), I plan to add them here...

*Open your terminal*

```bash

$ git clone [email protected]:blairanderson/rails-hackernews-reddit-producthunt-clone.git link-site
$ cd link-site

```

*Lets look at some code*

When someone visits your website, they're literally just *request*ing some HTML, CSS, and Javascript! *requests* come to your application through the ROUTER.

```ruby
# config/routes.rb

Rails.application.routes.draw do
resources :items, except: [:destroy] do
resources :item_comments
member do
post :toggle
post :vote, to: 'user_item_votes#create'
delete :vote, to: 'user_item_votes#destroy'
end
end

root to: 'items#index'

resources :users, except: [:index]
resources :user_sessions, only: [:new, :create, :destroy]

get 'login' => 'user_sessions#new', as: :login
match 'logout' => 'user_sessions#destroy', as: :logout, via: [:get, :post]

namespace :admin do
root to: 'items#index'
resources :items
end
end

```
20 changes: 12 additions & 8 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
Rails.application.routes.draw do
namespace :admin do
root to: 'items#index'
resources :items
end
# Updating routes? Please update the readme as well.

root to: 'items#index'
resources :user_sessions, only: [:new, :create, :destroy]
resources :users, except: [:index]
Rails.application.routes.draw do
resources :items, except: [:destroy] do
resources :item_comments
member do
Expand All @@ -16,6 +10,16 @@
end
end

root to: 'items#index'

resources :users, except: [:index]
resources :user_sessions, only: [:new, :create, :destroy]

get 'login' => 'user_sessions#new', as: :login
match 'logout' => 'user_sessions#destroy', as: :logout, via: [:get, :post]

namespace :admin do
root to: 'items#index'
resources :items
end
end

0 comments on commit e96a80d

Please sign in to comment.